From f263712185acbe19a4f2d1da1b2a06719339cecc Mon Sep 17 00:00:00 2001 From: Pierre-Olivier Mercier Date: Sun, 2 Apr 2023 18:45:35 +0200 Subject: [PATCH] Fix non-standard SQL statement in score calculation --- libfic/stats.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libfic/stats.go b/libfic/stats.go index 5961e960..83573ca8 100644 --- a/libfic/stats.go +++ b/libfic/stats.go @@ -39,7 +39,7 @@ func exoptsQuery(whereExo string) string { } query := `SELECT S.id_team, S.time, E.gain AS points, coeff, S.reason, S.id_exercice FROM ( - SELECT id_team, id_exercice, MIN(time) AS time, ` + fmt.Sprintf("%f", FirstBlood) + ` AS coeff, "First blood" AS reason FROM exercice_solved GROUP BY id_exercice UNION + SELECT id_team, id_exercice, time, ` + fmt.Sprintf("%f", FirstBlood) + ` AS coeff, "First blood" AS reason FROM exercice_solved JOIN (SELECT id_exercice, MIN(time) time FROM exercice_solved GROUP BY id_exercice) d1 USING (id_exercice, time) UNION SELECT id_team, id_exercice, time, coefficient AS coeff, "Validation" AS reason FROM exercice_solved ) S INNER JOIN ` + exercices_table + ` E ON S.id_exercice = E.id_exercice UNION ALL SELECT B.id_team, B.time, F.bonus_gain AS points, 1 AS coeff, "Bonus flag" AS reason, F.id_exercice FROM flag_found B INNER JOIN exercice_flags F ON F.id_flag = B.id_flag WHERE F.bonus_gain != 0 HAVING points != 0 UNION ALL