Add a new setting to don't count same responses in scores
This commit is contained in:
parent
8dc460b507
commit
910ec94fd8
8 changed files with 44 additions and 5 deletions
|
|
@ -12,12 +12,20 @@ var FirstBlood = 0.12
|
|||
// SubmissionCostBase is the basis amount of point lost per submission
|
||||
var SubmissionCostBase = 0.5
|
||||
|
||||
// SubmissionUniqueness don't count multiple times identical tries.
|
||||
var SubmissionUniqueness = false
|
||||
|
||||
func exoptsQuery(whereExo string) string {
|
||||
tries_table := "exercice_tries"
|
||||
if SubmissionUniqueness {
|
||||
tries_table = "exercice_distinct_tries"
|
||||
}
|
||||
|
||||
return `SELECT S.id_team, S.time, E.gain AS points, coeff FROM (
|
||||
SELECT id_team, id_exercice, MIN(time) AS time, ` + fmt.Sprintf("%f", FirstBlood) + ` AS coeff FROM exercice_solved GROUP BY id_exercice UNION
|
||||
SELECT id_team, id_exercice, time, coefficient AS coeff FROM exercice_solved
|
||||
) S INNER JOIN exercices E ON S.id_exercice = E.id_exercice ` + whereExo + ` UNION ALL
|
||||
SELECT id_team, MAX(time) AS time, (FLOOR(COUNT(*)/10 - 1) * (FLOOR(COUNT(*)/10)))/0.2 + (FLOOR(COUNT(*)/10) * (COUNT(*)%10)) AS points, ` + fmt.Sprintf("%f", SubmissionCostBase * -1) + ` AS coeff FROM exercice_tries S ` + whereExo + ` GROUP BY id_exercice, id_team`
|
||||
SELECT id_team, MAX(time) AS time, (FLOOR(COUNT(*)/10 - 1) * (FLOOR(COUNT(*)/10)))/0.2 + (FLOOR(COUNT(*)/10) * (COUNT(*)%10)) AS points, ` + fmt.Sprintf("%f", SubmissionCostBase * -1) + ` AS coeff FROM ` + tries_table + ` S ` + whereExo + ` GROUP BY id_exercice, id_team`
|
||||
}
|
||||
|
||||
func rankQuery(whereTeam string) string {
|
||||
|
|
|
|||
Reference in a new issue