]> git.ais-ucla.org Git - stats.ais-ucla.org.git/commitdiff
fix leader.cgi
authorChristopher Milan <chrismilan@ucla.edu>
Mon, 17 Mar 2025 06:03:25 +0000 (23:03 -0700)
committerChristopher Milan <chrismilan@ucla.edu>
Mon, 17 Mar 2025 06:05:46 +0000 (23:05 -0700)
leader.cgi

index d356c0e04ebe60efca410590dc612c08c99544be..7b956da8d84f234bbd46f10e90bd395775fe0324 100755 (executable)
@@ -20,7 +20,7 @@ my $query_today = qq{
   SELECT u.name, SUM(g.util * (1.0/60.0)) AS gpu_hours
   FROM usage g
   JOIN users u ON g.uid = u.uid
-  WHERE u.time >= datetime('now', 'start of day')
+  WHERE g.time >= datetime('now', 'start of day')
   GROUP BY u.uid
   ORDER BY gpu_hours DESC;
 };
@@ -29,7 +29,7 @@ my $query_week = qq{
   SELECT u.name, SUM(g.util * (1.0/60.0)) AS gpu_hours
   FROM usage g
   JOIN users u ON g.uid = u.uid
-  WHERE u.time >= datetime('now', 'start of day', '-' || strftime('%w', 'now') || ' days')
+  WHERE g.time >= datetime('now', 'start of day', '-' || strftime('%w', 'now') || ' days')
   GROUP BY u.uid
   ORDER BY gpu_hours DESC;
 };
@@ -38,7 +38,7 @@ my $query_month = qq{
   SELECT u.name, SUM(g.util * (1.0/60.0)) AS gpu_hours
   FROM usage g
   JOIN users u ON g.uid = u.uid
-  WHERE u.time >= datetime('now', 'start of month')
+  WHERE g.time >= datetime('now', 'start of month')
   GROUP BY u.uid
   ORDER BY gpu_hours DESC;
 };
@@ -145,6 +145,9 @@ END
 
 # Finish HTML and cleanup
 print end_html;
-$sth->finish();
+$sth_today->finish();
+$sth_week->finish();
+$sth_month->finish();
+$sth_alltime->finish();
 $dbh->disconnect();