libfic: Can retrieve the Theme from an exercice

This commit is contained in:
nemunaire 2016-01-23 12:23:14 +01:00
commit c1746f3dc7

View file

@ -107,6 +107,14 @@ func (e Exercice) Update() (int64, error) {
}
}
func (e Exercice) GetTheme() (Theme, error) {
var tid int
if err := DBQueryRow("SELECT id_theme FROM exercices WHERE id_exercice=?", e.Id).Scan(&tid); err != nil {
return Theme{}, err
}
return GetTheme(tid)
}
func (e Exercice) Delete() (int64, error) {
if res, err := DBExec("DELETE FROM exercices WHERE id_exercice = ?", e.Id); err != nil {
return 0, err