sync: Handle repochecker-ack.txt in exercice directory

This commit is contained in:
nemunaire 2023-06-14 17:24:15 +02:00
commit f366d6b8c1
4 changed files with 28 additions and 13 deletions

View file

@ -87,7 +87,7 @@ func (c *CheckExceptions) HasException(ref string) bool {
return false
}
func LoadException(i Importer, th *fic.Theme) (exceptions *CheckExceptions) {
func LoadThemeException(i Importer, th *fic.Theme) (exceptions *CheckExceptions) {
if fexcept, err := GetFileContent(i, filepath.Join(th.Path, "repochecker-ack.txt")); err == nil {
exceptions = &CheckExceptions{}
for n, line := range strings.Split(fexcept, "\n") {
@ -97,3 +97,19 @@ func LoadException(i Importer, th *fic.Theme) (exceptions *CheckExceptions) {
return
}
func LoadExerciceException(i Importer, th *fic.Theme, e *fic.Exercice, th_exceptions *CheckExceptions) (exceptions *CheckExceptions) {
if th_exceptions == nil {
th_exceptions = LoadThemeException(i, th)
}
exceptions = th_exceptions.GetExerciceExceptions(e)
if fexcept, err := GetFileContent(i, filepath.Join(e.Path, "repochecker-ack.txt")); err == nil {
for n, line := range strings.Split(fexcept, "\n") {
(*exceptions)[strings.TrimSpace(line)] = fmt.Sprintf("repochecker-ack.txt:%d", n+1)
}
}
return
}

View file

@ -105,8 +105,8 @@ func BuildExercice(i Importer, theme *fic.Theme, epath string, dmap *map[int64]*
return nil, p, eid, edir, errs
}
// Limit exceptions to this exercice
exceptions = exceptions.GetExerciceExceptions(e)
// Get exceptions
exceptions = LoadExerciceException(i, theme, e, exceptions)
//log.Printf("Kept repochecker exceptions for this exercice: %v", exceptions)
e.Language = theme.Language

View file

@ -110,7 +110,7 @@ func BuildTheme(i Importer, tdir string) (th *fic.Theme, exceptions *CheckExcept
th.Path = tdir
// Get exceptions
exceptions = LoadException(i, th)
exceptions = LoadThemeException(i, th)
// Overwrite language
if language, err := GetFileContent(i, path.Join(tdir, "language.txt")); err == nil {