libfic: new function to retrieve exercices from a hint

This commit is contained in:
nemunaire 2017-01-24 02:18:05 +01:00 committed by Pierre-Olivier Mercier
parent 4fe641a9f5
commit cab95b7985

View File

@ -84,3 +84,12 @@ func (h EHint) Delete() (int64, error) {
return nb, err
}
}
func (h EHint) GetExercice() (Exercice, error) {
var eid int64
if err := DBQueryRow("SELECT id_exercice FROM exercice_hints WHERE id_hint = ?", h.Id).Scan(&eid); err != nil {
return Exercice{}, err
}
return GetExercice(eid)
}