[Midnightbsd-cvs] mports: index.cgi: send the stats information to each page.

ctriv at midnightbsd.org ctriv at midnightbsd.org
Wed Oct 31 18:34:01 EDT 2007


Log Message:
-----------
send the stats information to each page.

Modified Files:
--------------
    mports/Tools/magus/www/data/magus:
        index.cgi (r1.1 -> r1.2)

-------------- next part --------------
Index: index.cgi
===================================================================
RCS file: /home/cvs/mports/Tools/magus/www/data/magus/index.cgi,v
retrieving revision 1.1
retrieving revision 1.2
diff -LTools/magus/www/data/magus/index.cgi -LTools/magus/www/data/magus/index.cgi -u -r1.1 -r1.2
--- Tools/magus/www/data/magus/index.cgi
+++ Tools/magus/www/data/magus/index.cgi
@@ -59,22 +59,6 @@
     results   => \@results
   );
   
-  my $dbh = Magus::Result->db_Main();
-  my $sth = $dbh->prepare("SELECT summary,COUNT(*) as count FROM results JOIN ports ON results.port=ports.name AND results.version=ports.version GROUP BY summary ORDER BY count DESC");
-  $sth->execute;
-  my $stats = $sth->fetchall_arrayref({});
-  $sth->finish;
-
-  $sth = $dbh->prepare("SELECT COUNT(DISTINCT port) FROM results");
-  $sth->execute;
-  my ($count) = $sth->fetchrow_array;
-  $sth->finish;
-
-  $sth = $dbh->prepare("SELECT COUNT(*) FROM ports WHERE name NOT IN (SELECT port FROM results)");
-  $sth->execute;
-  my ($untested) = $sth->fetchrow_array;
-  $sth->finish;
-  
   my @locks = map {{
     port    => $_->port->name,
     machine => $_->machine->name,
@@ -82,9 +66,6 @@
   }} Magus::Lock->retrieve_all;
   
   $tmpl->param(
-    ports_tested => $count,
-    ports_untested => $untested,
-    stats => $stats, 
     locks => \@locks
   ); 
   print $tmpl->output;
@@ -227,7 +208,26 @@
     die_on_bad_params => 0
   );
   
+  my $dbh = Magus::Result->db_Main();
+  my $sth = $dbh->prepare("SELECT summary,COUNT(*) as count FROM results JOIN ports ON results.port=ports.name AND results.version=ports.version GROUP BY summary ORDER BY count DESC");
+  $sth->execute;
+  my $stats = $sth->fetchall_arrayref({});
+  $sth->finish;
+
+  $sth = $dbh->prepare("SELECT COUNT(DISTINCT port) FROM results");
+  $sth->execute;
+  my ($count) = $sth->fetchrow_array;
+  $sth->finish;
+  
+  $sth = $dbh->prepare("SELECT COUNT(*) FROM ports WHERE name NOT IN (SELECT port FROM results)");
+  $sth->execute;
+  my ($untested) = $sth->fetchrow_array;
+  $sth->finish;
+  
   $tmpl->param(
+    ports_tested => $count,
+    ports_untested => $untested,
+    stats     => $stats,
     title     => 'Magus',
 #    breadcrumbs => breadcrumbs(path => $p->path_info or '/'),
     root      => $p->script_name(),


More information about the Midnightbsd-cvs mailing list