admin/sync: includes mcq and ucq in full synchronization

This commit is contained in:
nemunaire 2018-01-06 18:02:38 +01:00
parent 935b1666ac
commit 24f527ab8a

View file

@ -5,6 +5,7 @@ import (
"fmt" "fmt"
"log" "log"
"os" "os"
"path"
"time" "time"
"sync" "sync"
@ -31,7 +32,19 @@ func SyncDeep(i Importer) map[string][]string {
for _, exercice := range exercices { for _, exercice := range exercices {
errs[theme.Name] = append(errs[theme.Name], SyncExerciceFiles(i, exercice)...) 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], SyncExerciceHints(i, exercice)...)
hasFlags := false
if i.exists(path.Join(exercice.Path, "flags.txt")) {
errs[theme.Name] = append(errs[theme.Name], SyncExerciceKeys(i, exercice)...) 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)))
}
} }
} }
} }