Save MCQ diff

This commit is contained in:
nemunaire 2017-12-17 02:48:02 +01:00
commit 830dacd6f5
5 changed files with 28 additions and 2 deletions

View file

@ -146,6 +146,15 @@ func (t Team) CountTries(e Exercice) (int64, time.Time) {
}
}
func (t Team) LastTryDist(e Exercice) int64 {
var nb *int64
if DBQueryRow("SELECT nbdiff FROM exercice_tries WHERE id_team = ? AND id_exercice = ? ORDER BY time DESC LIMIT 1", t.Id, e.Id).Scan(&nb); nb == nil {
return 0
} else {
return *nb
}
}
func (t Team) HasSolved(e Exercice) (bool, time.Time, int64) {
var nb *int64
var tm *time.Time