From c87445b85bcb5a691bb7053ad81e589049662348 Mon Sep 17 00:00:00 2001 From: troubled-irc Date: Mon, 12 Mar 2007 21:12:04 +0000 Subject: [PATCH] stats are per channel instead of global ('PRIVATE') only git-svn-id: https://svn.code.sf.net/p/infobot/code/trunk/blootbot@1317 c11ca15a-4712-0410-83d8-924469b57eb5 --- ChangeLog | 10 ++++++++++ src/Process.pl | 6 ++---- src/UserExtra.pl | 2 +- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 51a6793..d3ffba8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2007-03-11 22:00 troubled + + * src/{Process.pl,UserExtra.pl}: Fixed bug with karma stats. 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. As a result, you should probably: + DELETE FROM stats WHERE channel = 'PRIVATE' AND "type" = 'karma'; + to clean up since they will never match now, or be pointless to + keep track of because karma can only be done in channel. + 2007-03-08 00:00 troubled * files/sample/blootbot.config: set tempDir changed to /tmp and diff --git a/src/Process.pl b/src/Process.pl index f9cd46c..d2f1e5e 100644 --- a/src/Process.pl +++ b/src/Process.pl @@ -309,16 +309,14 @@ sub process { } 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, } ); diff --git a/src/UserExtra.pl b/src/UserExtra.pl index b139ad6..6d1223b 100644 --- a/src/UserExtra.pl +++ b/src/UserExtra.pl @@ -192,7 +192,7 @@ sub factstats { 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"); -- 2.39.2