libfic: new function to retrieve exercices from a hint

This commit is contained in:
nemunaire 2017-01-24 02:18:05 +01:00
parent cc1e7f9e7a
commit 96c93e3d1a

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