changeset 598:ba84d8e35d6b

Do not count entries that have been flagged as disqualified.
author Matti Hamalainen <ccr@tnsp.org>
date Sun, 26 Oct 2014 22:09:32 +0200
parents 6de22c51c49b
children eebbc96d7fe5
files msite.inc.php pages/vote.inc.php
diffstat 2 files changed, 9 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/msite.inc.php	Wed Oct 22 19:48:03 2014 +0300
+++ b/msite.inc.php	Sun Oct 26 22:09:32 2014 +0200
@@ -471,7 +471,8 @@
     // Check if there are any entries for it
     $sql =
       "SELECT COUNT(*) FROM entries ".
-      "WHERE compo_id=".$compo["id"];
+      "WHERE compo_id=".$compo["id"]." ".
+      "AND (entries.flags & ".EFLAG_DISQUALIFIED.")=0";
 
     if (($nentries = stFetchSQLColumn($sql)) !== FALSE && $nentries > 0)
     {
--- a/pages/vote.inc.php	Wed Oct 22 19:48:03 2014 +0300
+++ b/pages/vote.inc.php	Sun Oct 26 22:09:32 2014 +0200
@@ -120,7 +120,12 @@
   foreach (stExecSQL("SELECT * FROM compos WHERE visible<>0 AND voting<>0") as $compo)
   {
     $cid = $compo["id"];
-    $nentries = stFetchSQLColumn("SELECT COUNT(*) FROM entries WHERE compo_id=".$cid);
+    $esql = 
+      "FROM entries "
+      "WHERE (flags & ".EFLAG_DISQUALIFIED.")=0 ".
+      "AND compo_id=".$cid;
+
+    $nentries = stFetchSQLColumn("SELECT COUNT(*) ".$esql);
     if ($nentries > 0)
     {
       echo
@@ -140,7 +145,7 @@
       "  </tr>\n";
 
       $row = 0;
-      foreach (stExecSQL("SELECT * FROM entries WHERE compo_id=".$cid) as $entry)
+      foreach (stExecSQL("SELECT * ".$esql) as $entry)
       {
         $eid = $entry["id"];
         echo