From f3852bd3b377919fdbb3e6a3a351a0ce62f30bac Mon Sep 17 00:00:00 2001 From: "Matteo Nastasi (mop)" Date: Wed, 26 Feb 2014 09:31:21 +0100 Subject: [PATCH] uniform games order with tstamp instead of code (useful during development) --- web/Obj/dbase_pgsql.phh | 4 ++-- web/briskin5/stat-day.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/web/Obj/dbase_pgsql.phh b/web/Obj/dbase_pgsql.phh index 9a0baa3..5f0511e 100644 --- a/web/Obj/dbase_pgsql.phh +++ b/web/Obj/dbase_pgsql.phh @@ -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); diff --git a/web/briskin5/stat-day.php b/web/briskin5/stat-day.php index a895d7c..0359bfe 100644 --- a/web/briskin5/stat-day.php +++ b/web/briskin5/stat-day.php @@ -337,7 +337,7 @@ SELECT g.* FROM %sbin5_tournaments AS t, %sbin5_matches AS m, %sbin5_games AS g SELECT p.pts AS pts FROM %sbin5_games AS g, %sbin5_points AS p WHERE g.code = p.gcode AND g.mcode = %d AND p.ucode = %d - ORDER BY g.code", + ORDER BY g.tstamp", $G_dbpfx, $G_dbpfx, $tmt_obj->code, $users[$u]['code']); -- 2.17.1