New settings to only count bad submissions

This commit is contained in:
nemunaire 2021-09-08 03:34:48 +02:00
commit cd73622cae
9 changed files with 61 additions and 18 deletions

View file

@ -353,6 +353,7 @@ CREATE TABLE IF NOT EXISTS exercice_tries(
time TIMESTAMP NOT NULL,
cksum BINARY(64) NOT NULL,
nbdiff INTEGER NOT NULL DEFAULT 0,
onegood BOOLEAN NOT NULL DEFAULT 0,
FOREIGN KEY(id_exercice) REFERENCES exercices(id_exercice),
FOREIGN KEY(id_team) REFERENCES teams(id_team)
) DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci;
@ -488,7 +489,13 @@ CREATE TABLE IF NOT EXISTS teams_qa_view(
return err
}
if _, err := db.Exec("CREATE OR REPLACE VIEW exercice_distinct_tries AS SELECT id_exercice, id_team, MAX(time) AS time, cksum, nbdiff FROM exercice_tries GROUP BY id_team, id_exercice, cksum;"); err != nil {
if _, err := db.Exec("CREATE OR REPLACE VIEW exercice_distinct_tries AS SELECT id_exercice, id_team, MAX(time) AS time, cksum, nbdiff, MAX(onegood) FROM exercice_tries GROUP BY id_team, id_exercice, cksum;"); err != nil {
return err
}
if _, err := db.Exec("CREATE OR REPLACE VIEW exercice_tries_notgood AS SELECT id_exercice, id_team, time, cksum, nbdiff, onegood FROM exercice_tries WHERE onegood = 0;"); err != nil {
return err
}
if _, err := db.Exec("CREATE OR REPLACE VIEW exercice_distinct_tries_notgood AS SELECT id_exercice, id_team, MAX(time) AS time, cksum, nbdiff, MAX(onegood) FROM exercice_tries_notgood GROUP BY id_team, id_exercice, cksum;"); err != nil {
return err
}