qa: Use GetThemesExtended to include standalones exercices
This commit is contained in:
parent
38fa6ec1de
commit
a82e3642a8
2 changed files with 22 additions and 2 deletions
|
|
@ -56,6 +56,26 @@ func GetThemes() ([]*Theme, error) {
|
|||
}
|
||||
}
|
||||
|
||||
// GetThemesExtended returns a list of Themes including standalone exercices.
|
||||
func GetThemesExtended() ([]*Theme, error) {
|
||||
if themes, err := GetThemes(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
// Append standalone exercices fake-themes
|
||||
stdthm := &Theme{
|
||||
Name: "Défis indépendants",
|
||||
URLId: "_",
|
||||
Path: "exercices",
|
||||
}
|
||||
|
||||
if exercices, err := stdthm.GetExercices(); err == nil && len(exercices) > 0 {
|
||||
themes = append(themes, stdthm)
|
||||
}
|
||||
|
||||
return themes, nil
|
||||
}
|
||||
}
|
||||
|
||||
// GetTheme retrieves a Theme from its identifier.
|
||||
func GetTheme(id int64) (*Theme, error) {
|
||||
t := &Theme{}
|
||||
|
|
|
|||
Reference in a new issue