admin: Can list independant exercices as theme

This commit is contained in:
nemunaire 2025-03-27 16:25:48 +01:00
commit 5e262b75a3
3 changed files with 27 additions and 8 deletions

View file

@ -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
}
}