themes.json: add stat of tries count
This commit is contained in:
parent
e55804fecb
commit
9b293b7d32
2 changed files with 20 additions and 0 deletions
|
|
@ -158,6 +158,24 @@ func (e Exercice) SolvedCount() int64 {
|
|||
}
|
||||
}
|
||||
|
||||
func (e Exercice) TriedTeamCount() int64 {
|
||||
var nb int64
|
||||
if err := DBQueryRow("SELECT COUNT(DISTINCT id_team) FROM exercice_tries WHERE id_exercice = ?", e.Id).Scan(&nb); err != nil {
|
||||
return 0
|
||||
} else {
|
||||
return nb
|
||||
}
|
||||
}
|
||||
|
||||
func (e Exercice) TriedCount() int64 {
|
||||
var nb int64
|
||||
if err := DBQueryRow("SELECT COUNT(id_team) FROM exercice_tries WHERE id_exercice = ?", e.Id).Scan(&nb); err != nil {
|
||||
return 0
|
||||
} else {
|
||||
return nb
|
||||
}
|
||||
}
|
||||
|
||||
func (e Exercice) CheckResponse(resps map[string]string, t Team) (bool, error) {
|
||||
s, _, _ := t.HasSolved(e)
|
||||
if s {
|
||||
|
|
|
|||
Reference in a new issue