diff --git a/admin/sync/full.go b/admin/sync/full.go index 0eb6b528..f92b5961 100644 --- a/admin/sync/full.go +++ b/admin/sync/full.go @@ -5,6 +5,7 @@ import ( "fmt" "log" "os" + "path" "time" "sync" @@ -31,7 +32,19 @@ func SyncDeep(i Importer) map[string][]string { for _, exercice := range exercices { errs[theme.Name] = append(errs[theme.Name], SyncExerciceFiles(i, exercice)...) errs[theme.Name] = append(errs[theme.Name], SyncExerciceHints(i, exercice)...) - errs[theme.Name] = append(errs[theme.Name], SyncExerciceKeys(i, exercice)...) + + hasFlags := false + if i.exists(path.Join(exercice.Path, "flags.txt")) { + errs[theme.Name] = append(errs[theme.Name], SyncExerciceKeys(i, exercice)...) + hasFlags = true + } + if i.exists(path.Join(exercice.Path, "flags-mcq.txt")) || i.exists(path.Join(exercice.Path, "flags-ucq.txt")) { + errs[theme.Name] = append(errs[theme.Name], SyncExerciceMCQ(i, exercice)...) + hasFlags = true + } + if !hasFlags { + errs[theme.Name] = append(errs[theme.Name], fmt.Sprintf("%q: has no flags!", path.Base(exercice.Path))) + } } } }