Actually display the correct stats in stats.cgi. Also move the footer down a little.

This commit is contained in:
zach%zachlipton.com 2005-08-17 23:35:30 +00:00
Родитель 70b21a2b5c
Коммит d15cc01f5b
2 изменённых файлов: 12 добавлений и 11 удалений

Просмотреть файл

@ -65,7 +65,8 @@ p#banner-version { font-size: 85%; }
background-color: #FFFF99;
width: 55%;
border: 1px solid #000;
bottom: 10px;
position: relative;
bottom: -15px;
}
.pagetitle

Просмотреть файл

@ -34,28 +34,28 @@ my $c = new CGI;
print $c->header();
# find the number of testcases in the database
Litmus::DB::Test->set_sql('numtests', "SELECT COUNT(*) as count from __TABLE__");
my $numtests = Litmus::DB::Test->search_numtests()->next()->count();
my $numtests = Litmus::DB::Test->count_all();
# find the number of users in the database
Litmus::DB::User->set_sql('numusers', "SELECT COUNT(*) as count from __TABLE__");
my $numusers = Litmus::DB::User->search_numusers()->next()->count();
my $numusers = Litmus::DB::User->count_all();
# get a list of the top 15 testers of all time, sorted by the number
# of test results submitted:
Litmus::DB::User->set_sql('toptesters', "SELECT users.userid, count(*) AS count
my $dbh = Litmus::DB::User->db_Main();
my $sth = $dbh->prepare("SELECT userid, email, count(*) AS thecount
FROM users, testresults
WHERE
users.userid=testresults.user
GROUP BY user
ORDER BY count DESC
ORDER BY thecount DESC
LIMIT 15;");
my @testers = Litmus::DB::User->search_toptesters();
$sth->execute();
my @toptesters;
foreach my $curtester (@testers) {
my @curtester;
while (@curtester = $sth->fetchrow_array()) {
my %testerinfo;
$testerinfo{"email"} = $curtester->email();
$testerinfo{"numtests"} = $curtester->count();
$testerinfo{"email"} = $curtester[1];
$testerinfo{"numtests"} = $curtester[2];
push(@toptesters, \%testerinfo);
}