db: Add a published attribute, filled by challenge.txt

This commit is contained in:
nemunaire 2022-10-31 18:52:29 +01:00
commit a28f108b8a
7 changed files with 75 additions and 19 deletions

View file

@ -134,6 +134,12 @@ func SyncExerciceFiles(i Importer, exercice *fic.Exercice, exceptions *CheckExce
errs = append(errs, err)
}
paramsFiles, err := GetExerciceFilesParams(i, exercice)
if err != nil {
errs = append(errs, NewChallengeTxtError(exercice, 0, err))
return
}
files, digests, berrs := BuildFilesListInto(i, exercice, "files")
errs = append(errs, berrs...)
@ -147,7 +153,13 @@ func SyncExerciceFiles(i Importer, exercice *fic.Exercice, exceptions *CheckExce
digest_shown = d
}
}
return exercice.ImportFile(filePath, origin, digests[fname], digest_shown)
published := true
if f, exists := paramsFiles[fname]; exists {
published = !f.Hidden
}
return exercice.ImportFile(filePath, origin, digests[fname], digest_shown, published)
}); err != nil {
errs = append(errs, NewFileError(exercice, fname, err))
continue