All pastes #391923 Raw Edit

Patch to make stats per channel again

public text v1 · immutable
·published 2007-03-12 15:09 UTC
rendered paste body
Index: src/Process.pl
===================================================================
--- src/Process.pl	(revision 1316)
+++ src/Process.pl	(working copy)
@@ -309,16 +309,14 @@
 	}
 
 	my $karma = &sqlSelect("stats", "counter",
-		{ nick => $term, type => "karma" }) || 0;
+		{ nick => $term, type => "karma", channel => $chan }) || 0;
 	if ($inc eq '++') {
 	    $karma++;
 	} else {
 	    $karma--;
 	}
 
-	&sqlSet("stats", {'nick' => $term}, {
-	    nick	=> $term,
-	    type	=> "karma",
+	&sqlSet("stats", {'nick' => $term, type => "karma", channel => $chan}, {
 	    'time'	=> time(),
 	    counter	=> $karma,
 	} );
Index: src/UserExtra.pl
===================================================================
--- src/UserExtra.pl	(revision 1316)
+++ src/UserExtra.pl	(working copy)
@@ -192,7 +192,7 @@
 sub karma {
     my $target	= lc( shift || $who );
     my $karma	= &sqlSelect("stats", "counter",
-	{ nick => $target, type => "karma" }) || 0;
+	{ nick => $target, type => "karma", channel => $chan }) || 0;
 
     if ($karma != 0) {
 	&performStrictReply("$target has karma of $karma");
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 1316)
+++ ChangeLog	(working copy)
@@ -1,3 +1,10 @@
+2007-03-11 22:00  troubled
+
+	* src/{Process.pl,UserExtra.pl}: Fixed bug with stats table. It
+	  wasnt supplying the channel and causing a dupe pkey issue and
+	  also resulted in global stats instead of per channel. Stats
+	  are now per channel.....again....
+
 2007-03-08 00:00  troubled
 
 	* files/sample/blootbot.config: set tempDir changed to /tmp and