[SimBot-commits] CVS: simbot/plugins sqlite-logger.pl,1.66,1.67
Status: Abandoned
Brought to you by:
kstange
|
From: Pete P. <fou...@us...> - 2005-08-18 23:10:48
|
Update of /cvsroot/simbot/simbot/plugins In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27628/plugins Modified Files: sqlite-logger.pl Log Message: Initialize the hours array with zeros Index: sqlite-logger.pl =================================================================== RCS file: /cvsroot/simbot/simbot/plugins/sqlite-logger.pl,v retrieving revision 1.66 retrieving revision 1.67 diff -u -d -p -r1.66 -r1.67 --- sqlite-logger.pl 18 Aug 2005 18:56:08 -0000 1.66 +++ sqlite-logger.pl 18 Aug 2005 23:10:09 -0000 1.67 @@ -988,6 +988,10 @@ sub web_stats { my @hour_list; my $max_hour; + + for(my $x=0; $x <= 23; $x++) { + $hour_list[$x] = { hour => $x, percent => 0 }; + } while ( my ( $hour, $count ) = $hour_counts_query->fetchrow_array ) { my %hash; @@ -998,9 +1002,8 @@ sub web_stats { $hash{'hour'} = $hour; $hash{'percent'} = ( $count / $max_hour ) * 100; - push( @hour_list, \%hash ); + $hour_list[$hour] = \%hash; } - @hour_list = sort { $a->{'hour'} <=> $b->{'hour'} } @hour_list; # Now, figure out some odd stats... @@ -1159,6 +1162,10 @@ sub web_stats { my @hour_list; my $max_hour; + + for(my $x=0; $x <= 23; $x++) { + $hour_list[$x] = { hour => $x, percent => 0 }; + } while ( my ( $hour, $count ) = $hour_counts_query->fetchrow_array ) { my %hash; @@ -1169,9 +1176,8 @@ sub web_stats { $hash{'hour'} = $hour; $hash{'percent'} = ( $count / $max_hour ) * 100; - push( @hour_list, \%hash ); + $hour_list[$hour] = \%hash; } - @hour_list = sort { $a->{'hour'} <=> $b->{'hour'} } @hour_list; my $nick_stats_query = $dbh->prepare_cached( |