vadvs (vadvs) wrote in changelog,
vadvs
vadvs
changelog

[livejournal] r21993: LJSUP-12252: prevent the subtraction of ...

Committer: vad
LJSUP-12252: prevent the subtraction of the user interests counter, if it is equal to zero
U   trunk/htdocs/interests.bml
Modified: trunk/htdocs/interests.bml
===================================================================
--- trunk/htdocs/interests.bml	2012-05-18 12:13:29 UTC (rev 21992)
+++ trunk/htdocs/interests.bml	2012-05-18 12:17:46 UTC (rev 21993)
@@ -327,7 +327,7 @@
             my $dbh = LJ::get_db_writer();
             $dbh->do("DELETE FROM $uitable WHERE userid=? AND intid IN ($intid_in)",
                      undef, $u->{'userid'});
-            $dbh->do("UPDATE interests SET intcount=intcount-1 WHERE intid IN ($intid_in)");
+            $dbh->do("UPDATE interests SET intcount=intcount-1 WHERE intid IN ($intid_in) AND intcount > 0");
             $deleted = 1;
         }
         if (@toadd) {

Tags: bml, livejournal, vad, vadvs
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments