Theme can be optional: exercices can be standalone
This commit is contained in:
parent
3519f7416d
commit
a0bc832910
8 changed files with 81 additions and 39 deletions
|
|
@ -68,7 +68,7 @@ type myTeamMCQJustifiedChoice struct {
|
|||
Justification myTeamFlag `json:"justification,omitempty"`
|
||||
}
|
||||
type myTeamExercice struct {
|
||||
ThemeId int64 `json:"theme_id"`
|
||||
ThemeId int64 `json:"theme_id,omitempty"`
|
||||
Disabled bool `json:"disabled,omitempty"`
|
||||
WIP bool `json:"wip,omitempty"`
|
||||
Statement string `json:"statement"`
|
||||
|
|
@ -136,11 +136,11 @@ func MyJSONTeam(t *Team, started bool) (interface{}, error) {
|
|||
return ret, err
|
||||
} else if started {
|
||||
for _, e := range exos {
|
||||
if t == nil || ((!e.Disabled || !mapthemes[e.IdTheme].Locked) && t.HasAccess(e)) {
|
||||
if t == nil || ((!e.Disabled || (e.IdTheme != nil && !mapthemes[*e.IdTheme].Locked)) && t.HasAccess(e)) {
|
||||
exercice := myTeamExercice{}
|
||||
exercice.Disabled = e.Disabled
|
||||
exercice.WIP = e.WIP
|
||||
exercice.ThemeId = e.IdTheme
|
||||
exercice.ThemeId = *e.IdTheme
|
||||
|
||||
exercice.Statement = strings.Replace(e.Statement, "$FILES$", FilesDir, -1)
|
||||
|
||||
|
|
|
|||
Reference in a new issue