diff --git a/admin/sync/full.go b/admin/sync/full.go index d112fd2e..1a64158c 100644 --- a/admin/sync/full.go +++ b/admin/sync/full.go @@ -72,9 +72,13 @@ func SpeedySyncDeep(i Importer) (errs SyncReport) { errs.ThemesSync = append(errs.ThemesSync, sterr.Error()) } - if themes, err := fic.GetThemesExtended(); err == nil { + if themes, err := fic.GetThemes(); err == nil { DeepSyncProgress = 2 + if i.Exists(fic.StandaloneExercicesDirectory) { + themes = append(themes, &fic.StandaloneExercicesTheme) + } + var themeStep uint8 = uint8(250) / uint8(len(themes)) for tid, theme := range themes { @@ -139,9 +143,14 @@ func SyncDeep(i Importer) (errs SyncReport) { } // Synchronize themes - if themes, err := fic.GetThemesExtended(); err == nil { + if themes, err := fic.GetThemes(); err == nil { DeepSyncProgress = 2 + // Also synchronize standalone exercices + if i.Exists(fic.StandaloneExercicesDirectory) { + themes = append(themes, &fic.StandaloneExercicesTheme) + } + var themeStep uint8 = uint8(250) / uint8(len(themes)) for tid, theme := range themes { diff --git a/admin/sync/themes.go b/admin/sync/themes.go index 09a4440b..8ac666d4 100644 --- a/admin/sync/themes.go +++ b/admin/sync/themes.go @@ -40,20 +40,6 @@ func GetThemes(i Importer) (themes []string, err error) { return themes, nil } -// GetThemesExtended returns all theme directories, including standalone exercices. -func GetThemesExtended(i Importer) (themes []string, err error) { - themes, err = GetThemes(i) - if err != nil { - return - } - - if i.Exists(fic.StandaloneExercicesDirectory) { - themes = append(themes, fic.StandaloneExercicesDirectory) - } - - return -} - // resizePicture makes the given image just fill the given rectangle. func resizePicture(i Importer, imgPath string, importedPath string, rect image.Rectangle) error { if fl, err := i.GetFile(imgPath); err != nil { diff --git a/fileexporter/main.go b/fileexporter/main.go index 2fa95ab9..7113c09d 100644 --- a/fileexporter/main.go +++ b/fileexporter/main.go @@ -33,7 +33,7 @@ func exportThemeFiles(tdir string) (errs error) { dmap := map[int64]*fic.Exercice{} for i, edir := range exercices { - log.Printf("In theme %s, doing exercice %d/%d: %s", tdir, i+1, len(exercices), edir) + log.Printf("In theme %s, doing exercice %d/%d: %s", tdir, i, len(exercices), tdir) err = exportExerciceFiles(theme, edir, &dmap, exceptions) errs = errors.Join(errs, err) } @@ -155,14 +155,14 @@ func main() { } } - themes, err := sync.GetThemesExtended(sync.GlobalImporter) + themes, err := sync.GetThemes(sync.GlobalImporter) if err != nil { log.Fatal(err) } hasError := false for i, tdir := range themes { - log.Printf("Doing theme %d/%d: %s", i+1, len(themes), tdir) + log.Printf("Doing theme %d/%d: %s", i, len(themes), tdir) err = exportThemeFiles(tdir) if err != nil { hasError = true