admin: Can list independant exercices as theme
This commit is contained in:
parent
d26333c5e2
commit
5e262b75a3
3 changed files with 27 additions and 8 deletions
|
|
@ -645,3 +645,14 @@ func (e *Exercice) IsSolved() (int, *time.Time) {
|
|||
return *nb, tm
|
||||
}
|
||||
}
|
||||
|
||||
func HasStandaloneExercice() (bool, error) {
|
||||
var nb int
|
||||
|
||||
err := DBQueryRow("SELECT COUNT(id_exercice) FROM exercices WHERE id_theme IS NULL").Scan(&nb)
|
||||
if err != nil {
|
||||
return false, err
|
||||
} else {
|
||||
return nb > 0, nil
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Reference in a new issue