changeset 919:71621519a883

Improve display of compo / entry statistics.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 27 Nov 2014 13:06:54 +0200
parents 2e106ba14190
children 054b612df423
files admajax.php
diffstat 1 files changed, 25 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/admajax.php	Thu Nov 27 12:57:50 2014 +0200
+++ b/admajax.php	Thu Nov 27 13:06:54 2014 +0200
@@ -835,9 +835,31 @@
     if ($nenabled > 0)
       echo "<li>".$nenabled." competitions that are NOT visible, but are enabled for voting?</li>\n";
 
-    $entries = stFetchSQL("SELECT COUNT(*) AS nentries, COUNT(DISTINCT compo_id) AS ncompos FROM entries");
-    if ($entries !== FALSE)
-      echo "<li><b>".$entries["nentries"]."</b> compo entries in system in <b>".$entries["ncompos"]."</b> compos.</li>\n";
+    // Count entries and compos
+    $nentries = $ncompos = 0;
+    foreach (stExecSQL("SELECT * FROM compos WHERE ctype=".COMPO_NORMAL) as $compo)
+    {
+      if (($ne = stFetchSQLColumn("SELECT COUNT(*) FROM entries WHERE compo_id=".$compo["id"])) !== false && $ne > 0)
+      {
+        $nentries += $ne;
+        $ncompos++;
+      }
+    }
+    if ($ncompos > 0)
+      echo "<li>VOTING COMPOS: <b>".$nentries."</b> compo entries in <b>".$ncompos."</b> compos.</li>\n";
+
+    $nentries = $ncompos = 0;
+    foreach (stExecSQL("SELECT * FROM compos WHERE ctype <> ".COMPO_NORMAL) as $compo)
+    {
+      if (($ne = stFetchSQLColumn("SELECT COUNT(*) FROM entries WHERE compo_id=".$compo["id"])) !== false && $ne > 0)
+      {
+        $nentries += $ne;
+        $ncompos++;
+      }
+    }
+    if ($ncompos > 0)
+      echo "<li>NON-VOTING COMPOS: <b>".$nentries."</b> entries/participants in <b>".$ncompos."</b> compos.</li>\n";
+
     
     if ($errors == 0)
       echo "<li>No errors/warnings detected.</li>\n";