uniform games order with tstamp instead of code (useful during development)
[brisk.git] / web / Obj / dbase_pgsql.phh
index 9a0baa3..5f0511e 100644 (file)
@@ -435,7 +435,7 @@ class BriskDB
             $pts_sql = sprintf("SELECT p.pts AS pts, g.mult AS mult
                                     FROM %sbin5_points as p, %sbin5_games as g
                                     WHERE p.gcode = g.code AND g.mcode = %d AND p.ucode = %d
-                                    ORDER BY g.code ASC
+                                    ORDER BY g.tstamp ASC
                                     LIMIT %d OFFSET %d;",
                                $G_dbpfx, $G_dbpfx, $match_code, $user['code'],
                                MAX_POINTS,
@@ -463,7 +463,7 @@ class BriskDB
             $u++;
         }
 
-        $gam_sql = sprintf("SELECT * FROM %sbin5_games WHERE mcode = %d ORDER BY code DESC LIMIT 1;", $G_dbpfx, $match_code);
+        $gam_sql = sprintf("SELECT * FROM %sbin5_games WHERE mcode = %d ORDER BY tstamp DESC LIMIT 1;", $G_dbpfx, $match_code);
         if (($gam_pg  = $this->query($gam_sql)) == FALSE || pg_numrows($gam_pg) != 1) {
             log_crit(sprintf("%s::%s: get last game fails", __CLASS__, __FUNCTION__));
             return (FALSE);