admin: new route to fill URLIds if they are not defined
This commit is contained in:
parent
8ae4d1c42f
commit
6d1ef0f51c
4 changed files with 56 additions and 0 deletions
|
@ -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 {
|
||||
|
|
Reference in a new issue