admin: new route to fill URLIds if they are not defined

This commit is contained in:
nemunaire 2018-01-23 01:00:24 +01:00
parent 8ae4d1c42f
commit 6d1ef0f51c
4 changed files with 56 additions and 0 deletions

View file

@ -122,6 +122,14 @@ func (e Exercice) Update() (int64, error) {
}
}
func (e *Exercice) FixURLId() bool {
if e.URLId == "" {
e.URLId = ToURLid(e.Title)
return true
}
return false
}
func (e Exercice) GetThemeId() (int, error) {
var tid int
if err := DBQueryRow("SELECT id_theme FROM exercices WHERE id_exercice=?", e.Id).Scan(&tid); err != nil {