From: Paul Date: Sun, 23 Nov 2008 21:53:42 +0000 (+0000) Subject: fix bug in G stats X-Git-Url: https://jfr.im/git/irc/quakenet/newserv.git/commitdiff_plain/8c684fca9c7dbb4a2601628c744be9236ee68641 fix bug in G stats --- diff --git a/helpmod2/hcommands.c b/helpmod2/hcommands.c index 35d138c5..050bed42 100644 --- a/helpmod2/hcommands.c +++ b/helpmod2/hcommands.c @@ -2037,12 +2037,14 @@ static void helpmod_cmd_activestaff (huser *sender, channel* returntype, char* o switch (listtype) { case 0: - for (i=0;i < arr.arrlen && arr.array[i].prime_time_spent > H_ACTIVE_LIMIT;i++) - helpmod_reply(sender, returntype, "#%-2d %-20s %-20s %-20s", i+1,((haccount*)(arr.array[i].owner))->name->content, helpmod_strtime(arr.array[i].prime_time_spent), helpmod_strtime(arr.array[i].time_spent)); + for (i=0;i < arr.arrlen;i++) + if (arr.array[i].prime_time_spent > H_ACTIVE_LIMIT) + helpmod_reply(sender, returntype, "#%-2d %-20s %-20s %-20s", i+1,((haccount*)(arr.array[i].owner))->name->content, helpmod_strtime(arr.array[i].prime_time_spent), helpmod_strtime(arr.array[i].time_spent)); break; case 1: - for (i=arr.arrlen-1;i >= 0 && arr.array[i].prime_time_spent < H_ACTIVE_LIMIT;i--) - helpmod_reply(sender, returntype, "#%-2d %-20s %-20s %-20s", (arr.arrlen - i),((haccount*)(arr.array[i].owner))->name->content, helpmod_strtime(arr.array[i].prime_time_spent), helpmod_strtime(arr.array[i].time_spent)); + for (i=arr.arrlen-1;i >= 0;i--) + if (arr.array[i].prime_time_spent < H_ACTIVE_LIMIT) + helpmod_reply(sender, returntype, "#%-2d %-20s %-20s %-20s", (arr.arrlen - i),((haccount*)(arr.array[i].owner))->name->content, helpmod_strtime(arr.array[i].prime_time_spent), helpmod_strtime(arr.array[i].time_spent)); break; } @@ -3510,7 +3512,8 @@ static void helpmod_cmd_weekstats (huser *sender, channel* returntype, char* ost helpmod_reply(sender, returntype, "Weekly statistics for %ss on channel %s", hlevel_name(lvl), hchannel_get_name(hchan)); - for (i=0;i < arr.arrlen && arr.array[i].time_spent > HDEF_m;i++) + for (i=0;i < arr.arrlen;i++) + if (arr.array[i].time_spent > HDEF_m) helpmod_reply(sender, returntype, "%-20s %-20s %-20s",((haccount*)(arr.array[i].owner))->name->content, helpmod_strtime(arr.array[i].prime_time_spent), helpmod_strtime(arr.array[i].time_spent)); free(arr.array); diff --git a/helpmod2/hstat.c b/helpmod2/hstat.c index bcc3762e..c879797b 100644 --- a/helpmod2/hstat.c +++ b/helpmod2/hstat.c @@ -335,7 +335,7 @@ hstat_channel_entry hstat_channel_last_month(hstat_channel *hs_chan) static int hstat_account_compare(hstat_account_entry_sum *e1, hstat_account_entry_sum *e2) { - return e2->prime_time_spent - e1->prime_time_spent; + return e2->time_spent - e1->time_spent; } hstat_accounts_array create_hstat_account_array(hchannel *hchan, hlevel lvl, hstat_account_array_type type)