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
|
|
@ -145,12 +145,17 @@ func (t Team) CanSeeFlag(k Flag) bool {
|
|||
|
||||
// NbTry retrieves the number of attempts made by the Team to the given challenge.
|
||||
func NbTry(t *Team, e Exercice) int {
|
||||
tries_table := "exercice_tries"
|
||||
if SubmissionUniqueness {
|
||||
tries_table = "exercice_distinct_tries"
|
||||
}
|
||||
|
||||
var cnt *int
|
||||
|
||||
if t != nil {
|
||||
DBQueryRow("SELECT COUNT(*) FROM exercice_tries WHERE id_team = ? AND id_exercice = ?", t.Id, e.Id).Scan(&cnt)
|
||||
DBQueryRow("SELECT COUNT(*) FROM " + tries_table + " WHERE id_team = ? AND id_exercice = ?", t.Id, e.Id).Scan(&cnt)
|
||||
} else {
|
||||
DBQueryRow("SELECT COUNT(*) FROM exercice_tries WHERE id_exercice = ?", e.Id).Scan(&cnt)
|
||||
DBQueryRow("SELECT COUNT(*) FROM " + tries_table + " WHERE id_exercice = ?", e.Id).Scan(&cnt)
|
||||
}
|
||||
|
||||
if cnt == nil {
|
||||
|
|
|
|||
Reference in a new issue