changeset 606:3d2b70fbeb78

Slight cleanups.
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 31 Oct 2014 21:47:02 +0200
parents f928b0a6e1af
children e78d90ca4f4a
files msite.inc.php
diffstat 1 files changed, 7 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/msite.inc.php	Mon Oct 27 14:29:56 2014 +0200
+++ b/msite.inc.php	Fri Oct 31 21:47:02 2014 +0200
@@ -54,8 +54,8 @@
 //
 // Competition types
 //
-define("COMPO_NORMAL", 0);          // Normal voting compo
-define("COMPO_POINTS", 1);          // Assigned points (no voting)
+define("COMPO_NORMAL", 0);          // Normal voting compo, points determine placement
+define("COMPO_POINTS", 1);          // Assigned points, points determines placement (no voting)
 define("COMPO_ASSIGN", 2);          // Assigned places (no voting)
 
 
@@ -414,7 +414,7 @@
 }
 
 
-function stGetCompoResultsSQL($mode, $compo_id)
+function stGetCompoResultsSQL($mode, $compo)
 {
   switch ($mode)
   {
@@ -448,7 +448,7 @@
   }
 
   $sql .= " ".
-    "WHERE entries.compo_id=".$compo_id." ".
+    "WHERE entries.compo_id=".$compo["id"]." ".
     "AND (entries.flags & ".EFLAG_DISQUALIFIED.")=0 ".
     "GROUP BY entries.id ".
     "ORDER BY votesum DESC";
@@ -459,7 +459,8 @@
 
 function stGetCompoResultsASCIIStr($showAuthors, $html)
 {
-  if (($res = stExecSQL("SELECT * FROM compos WHERE visible<>0 ORDER BY name DESC")) === false)
+  $sql = "SELECT * FROM compos WHERE visible<>0 ORDER BY name DESC";
+  if (($res = stExecSQL($sql)) === false)
     return "";
 
   $voteKeyMode = stGetSetting("voteKeyMode");
@@ -477,7 +478,7 @@
     if (($nentries = stFetchSQLColumn($sql)) !== FALSE && $nentries > 0)
     {
       // Get voting results by mode
-      $sql = stGetCompoResultsSQL($voteKeyMode, $compo["id"]);
+      $sql = stGetCompoResultsSQL($voteKeyMode, $compo);
 
       // List results
       $prev = FALSE;