Compare commits
2 commits
0309ccaafa
...
c53e5d9b9c
Author | SHA1 | Date | |
---|---|---|---|
c53e5d9b9c | |||
961542283d |
5 changed files with 25 additions and 20 deletions
|
@ -72,13 +72,9 @@ func SpeedySyncDeep(i Importer) (errs SyncReport) {
|
||||||
errs.ThemesSync = append(errs.ThemesSync, sterr.Error())
|
errs.ThemesSync = append(errs.ThemesSync, sterr.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
if themes, err := fic.GetThemes(); err == nil {
|
if themes, err := fic.GetThemesExtended(); err == nil {
|
||||||
DeepSyncProgress = 2
|
DeepSyncProgress = 2
|
||||||
|
|
||||||
if i.Exists(fic.StandaloneExercicesDirectory) {
|
|
||||||
themes = append(themes, &fic.StandaloneExercicesTheme)
|
|
||||||
}
|
|
||||||
|
|
||||||
var themeStep uint8 = uint8(250) / uint8(len(themes))
|
var themeStep uint8 = uint8(250) / uint8(len(themes))
|
||||||
|
|
||||||
for tid, theme := range themes {
|
for tid, theme := range themes {
|
||||||
|
@ -143,14 +139,9 @@ func SyncDeep(i Importer) (errs SyncReport) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Synchronize themes
|
// Synchronize themes
|
||||||
if themes, err := fic.GetThemes(); err == nil {
|
if themes, err := fic.GetThemesExtended(); err == nil {
|
||||||
DeepSyncProgress = 2
|
DeepSyncProgress = 2
|
||||||
|
|
||||||
// Also synchronize standalone exercices
|
|
||||||
if i.Exists(fic.StandaloneExercicesDirectory) {
|
|
||||||
themes = append(themes, &fic.StandaloneExercicesTheme)
|
|
||||||
}
|
|
||||||
|
|
||||||
var themeStep uint8 = uint8(250) / uint8(len(themes))
|
var themeStep uint8 = uint8(250) / uint8(len(themes))
|
||||||
|
|
||||||
for tid, theme := range themes {
|
for tid, theme := range themes {
|
||||||
|
|
|
@ -40,6 +40,20 @@ func GetThemes(i Importer) (themes []string, err error) {
|
||||||
return themes, nil
|
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.
|
// resizePicture makes the given image just fill the given rectangle.
|
||||||
func resizePicture(i Importer, imgPath string, importedPath string, rect image.Rectangle) error {
|
func resizePicture(i Importer, imgPath string, importedPath string, rect image.Rectangle) error {
|
||||||
if fl, err := i.GetFile(imgPath); err != nil {
|
if fl, err := i.GetFile(imgPath); err != nil {
|
||||||
|
|
|
@ -33,7 +33,7 @@ func exportThemeFiles(tdir string) (errs error) {
|
||||||
dmap := map[int64]*fic.Exercice{}
|
dmap := map[int64]*fic.Exercice{}
|
||||||
|
|
||||||
for i, edir := range exercices {
|
for i, edir := range exercices {
|
||||||
log.Printf("In theme %s, doing exercice %d/%d: %s", tdir, i, len(exercices), tdir)
|
log.Printf("In theme %s, doing exercice %d/%d: %s", tdir, i+1, len(exercices), edir)
|
||||||
err = exportExerciceFiles(theme, edir, &dmap, exceptions)
|
err = exportExerciceFiles(theme, edir, &dmap, exceptions)
|
||||||
errs = errors.Join(errs, err)
|
errs = errors.Join(errs, err)
|
||||||
}
|
}
|
||||||
|
@ -155,14 +155,14 @@ func main() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
themes, err := sync.GetThemes(sync.GlobalImporter)
|
themes, err := sync.GetThemesExtended(sync.GlobalImporter)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
hasError := false
|
hasError := false
|
||||||
for i, tdir := range themes {
|
for i, tdir := range themes {
|
||||||
log.Printf("Doing theme %d/%d: %s", i, len(themes), tdir)
|
log.Printf("Doing theme %d/%d: %s", i+1, len(themes), tdir)
|
||||||
err = exportThemeFiles(tdir)
|
err = exportThemeFiles(tdir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
hasError = true
|
hasError = true
|
||||||
|
|
6
frontend/fic/package-lock.json
generated
6
frontend/fic/package-lock.json
generated
|
@ -1500,9 +1500,9 @@
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/bootstrap": {
|
"node_modules/bootstrap": {
|
||||||
"version": "5.3.3",
|
"version": "5.3.5",
|
||||||
"resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-5.3.3.tgz",
|
"resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-5.3.5.tgz",
|
||||||
"integrity": "sha512-8HLCdWgyoMguSO9o+aH+iuZ+aht+mzW0u3HIMzVu7Srrpv7EBBxTnrFlSCskwdY1+EOFQSm7uMJhNQHkdPcmjg==",
|
"integrity": "sha512-ct1CHKtiobRimyGzmsSldEtM03E8fcEX4Tb3dGXz1V8faRwM50+vfHwTzOxB3IlKO7m+9vTH3s/3C6T2EAPeTA==",
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
"type": "github",
|
"type": "github",
|
||||||
|
|
6
qa/ui/package-lock.json
generated
6
qa/ui/package-lock.json
generated
|
@ -1180,9 +1180,9 @@
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/bootstrap": {
|
"node_modules/bootstrap": {
|
||||||
"version": "5.3.3",
|
"version": "5.3.5",
|
||||||
"resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-5.3.3.tgz",
|
"resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-5.3.5.tgz",
|
||||||
"integrity": "sha512-8HLCdWgyoMguSO9o+aH+iuZ+aht+mzW0u3HIMzVu7Srrpv7EBBxTnrFlSCskwdY1+EOFQSm7uMJhNQHkdPcmjg==",
|
"integrity": "sha512-ct1CHKtiobRimyGzmsSldEtM03E8fcEX4Tb3dGXz1V8faRwM50+vfHwTzOxB3IlKO7m+9vTH3s/3C6T2EAPeTA==",
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
"type": "github",
|
"type": "github",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue