sync: Introduce repochecker-ack.txt to support check exceptions

This commit is contained in:
nemunaire 2022-10-29 17:03:57 +02:00
commit fb368d79d1
17 changed files with 283 additions and 106 deletions

View file

@ -60,7 +60,7 @@ func SpeedySyncDeep(i Importer) (errs SyncReport) {
}
errs.DateStart = startTime
sterrs := SyncThemes(i)
exceptions, sterrs := SyncThemes(i)
for _, sterr := range sterrs {
errs.ThemesSync = append(errs.ThemesSync, sterr.Error())
}
@ -71,7 +71,7 @@ func SpeedySyncDeep(i Importer) (errs SyncReport) {
for tid, theme := range themes {
DeepSyncProgress = 3 + uint8(tid)*themeStep
seerrs := SyncExercices(i, theme)
seerrs := SyncExercices(i, theme, exceptions[theme.Path])
for _, seerr := range seerrs {
errs.Themes[theme.Name] = append(errs.Themes[theme.Name], seerr.Error())
}
@ -85,13 +85,13 @@ func SpeedySyncDeep(i Importer) (errs SyncReport) {
log.Printf("Speedy synchronization in progress: %d/255 - doing Theme %q, Exercice %q: %q\n", DeepSyncProgress, theme.Name, exercice.Title, exercice.Path)
DeepSyncProgress = 3 + uint8(tid)*themeStep + uint8(eid)*exerciceStep
flagsBindings, ferrs := SyncExerciceFlags(i, exercice)
flagsBindings, ferrs := SyncExerciceFlags(i, exercice, exceptions[theme.Path])
for _, ferr := range ferrs {
errs.Themes[theme.Name] = append(errs.Themes[theme.Name], ferr.Error())
}
DeepSyncProgress += exerciceStep / 2
_, herrs := SyncExerciceHints(i, exercice, flagsBindings)
_, herrs := SyncExerciceHints(i, exercice, flagsBindings, exceptions[theme.Path])
for _, herr := range herrs {
errs.Themes[theme.Name] = append(errs.Themes[theme.Name], herr.Error())
}
@ -128,7 +128,7 @@ func SyncDeep(i Importer) (errs SyncReport) {
}
errs.DateStart = startTime
sterrs := SyncThemes(i)
exceptions, sterrs := SyncThemes(i)
for _, sterr := range sterrs {
errs.ThemesSync = append(errs.ThemesSync, sterr.Error())
}
@ -138,7 +138,7 @@ func SyncDeep(i Importer) (errs SyncReport) {
var themeStep uint8 = uint8(250) / uint8(len(themes))
for tid, theme := range themes {
stderrs := SyncThemeDeep(i, theme, tid, themeStep)
stderrs := SyncThemeDeep(i, theme, tid, themeStep, exceptions[theme.Path])
for _, stderr := range stderrs {
errs.Themes[theme.Name] = append(errs.Themes[theme.Name], stderr.Error())
}
@ -209,7 +209,7 @@ func EditDeepReport(errs *SyncReport, erase bool) {
}
// SyncThemeDeep performs a recursive synchronisation: from challenges to challenge items.
func SyncThemeDeep(i Importer, theme *fic.Theme, tid int, themeStep uint8) (errs []error) {
func SyncThemeDeep(i Importer, theme *fic.Theme, tid int, themeStep uint8, exceptions *CheckExceptions) (errs []error) {
oneThemeDeepSync.Lock()
defer oneThemeDeepSync.Unlock()
@ -220,7 +220,7 @@ func SyncThemeDeep(i Importer, theme *fic.Theme, tid int, themeStep uint8) (errs
}
DeepSyncProgress = 3 + uint8(tid)*themeStep
errs = SyncExercices(i, theme)
errs = SyncExercices(i, theme, exceptions)
if exercices, err := theme.GetExercices(); err == nil && len(exercices) > 0 {
var exerciceStep uint8 = themeStep / uint8(len(exercices))
@ -228,14 +228,14 @@ func SyncThemeDeep(i Importer, theme *fic.Theme, tid int, themeStep uint8) (errs
log.Printf("Deep synchronization in progress: %d/255 - doing Theme %q, Exercice %q: %q\n", DeepSyncProgress, theme.Name, exercice.Title, exercice.Path)
DeepSyncProgress = 3 + uint8(tid)*themeStep + uint8(eid)*exerciceStep
errs = append(errs, SyncExerciceFiles(i, exercice)...)
errs = append(errs, SyncExerciceFiles(i, exercice, exceptions)...)
DeepSyncProgress += exerciceStep / 3
flagsBindings, ferrs := SyncExerciceFlags(i, exercice)
flagsBindings, ferrs := SyncExerciceFlags(i, exercice, exceptions)
errs = append(errs, ferrs...)
DeepSyncProgress += exerciceStep / 3
_, herrs := SyncExerciceHints(i, exercice, flagsBindings)
_, herrs := SyncExerciceHints(i, exercice, flagsBindings, exceptions)
errs = append(errs, herrs...)
}
}