From 8dc460b5078f53dd273384292a4122c05b06cb87 Mon Sep 17 00:00:00 2001 From: Pierre-Olivier Mercier Date: Thu, 6 Dec 2018 22:02:47 +0100 Subject: [PATCH] rank: count wchoices in score --- libfic/stats.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libfic/stats.go b/libfic/stats.go index 17be41f9..9d801f61 100644 --- a/libfic/stats.go +++ b/libfic/stats.go @@ -23,7 +23,8 @@ func exoptsQuery(whereExo string) string { func rankQuery(whereTeam string) string { return `SELECT A.id_team, SUM(A.points * A.coeff) AS score, MAX(A.time) AS time FROM ( ` + exoptsQuery("") + ` UNION ALL - SELECT D.id_team, D.time, H.cost AS points, -1.0 AS coeff FROM team_hints D INNER JOIN exercice_hints H ON H.id_hint = D.id_hint HAVING points != 0 + SELECT D.id_team, D.time, H.cost AS points, -1.0 AS coeff FROM team_hints D INNER JOIN exercice_hints H ON H.id_hint = D.id_hint HAVING points != 0 UNION ALL + SELECT W.id_team, W.time, F.choices_cost AS points, -1.0 AS coeff FROM team_wchoices W INNER JOIN exercice_flags F ON F.id_flag = W.id_flag HAVING points != 0 ) A ` + whereTeam + ` GROUP BY A.id_team ORDER BY score DESC, time ASC` }