Able to sync and export standalone exercices
This commit is contained in:
parent
76f830b332
commit
adb0e36dd4
15 changed files with 159 additions and 31 deletions
|
@ -32,6 +32,7 @@ type SyncReport struct {
|
|||
SyncId string `json:"_id,omitempty"`
|
||||
ThemesSync []string `json:"_themes,omitempty"`
|
||||
Themes map[string][]string `json:"themes"`
|
||||
Exercices []string `json:"exercices,omitempty"`
|
||||
}
|
||||
|
||||
// SpeedySyncDeep performs a recursive synchronisation without importing files.
|
||||
|
@ -57,6 +58,11 @@ func SpeedySyncDeep(i Importer) (errs SyncReport) {
|
|||
|
||||
if themes, err := fic.GetThemes(); err == nil {
|
||||
DeepSyncProgress = 2
|
||||
|
||||
if i.Exists(StandaloneExercicesDirectory) {
|
||||
themes = append([]*fic.Theme{}, &fic.Theme{Path: StandaloneExercicesDirectory})
|
||||
}
|
||||
|
||||
var themeStep uint8 = uint8(250) / uint8(len(themes))
|
||||
|
||||
for tid, theme := range themes {
|
||||
|
@ -113,14 +119,22 @@ func SyncDeep(i Importer) (errs SyncReport) {
|
|||
|
||||
startTime := time.Now()
|
||||
|
||||
// Import all themes
|
||||
errs.DateStart = startTime
|
||||
exceptions, sterrs := SyncThemes(i)
|
||||
for _, sterr := range multierr.Errors(sterrs) {
|
||||
errs.ThemesSync = append(errs.ThemesSync, sterr.Error())
|
||||
}
|
||||
|
||||
if themes, err := fic.GetThemes(); err == nil && len(themes) > 0 {
|
||||
// Synchronize themes
|
||||
if themes, err := fic.GetThemes(); err == nil {
|
||||
DeepSyncProgress = 2
|
||||
|
||||
// Also synchronize standalone exercices
|
||||
if i.Exists(StandaloneExercicesDirectory) {
|
||||
themes = append(themes, &fic.Theme{Path: StandaloneExercicesDirectory})
|
||||
}
|
||||
|
||||
var themeStep uint8 = uint8(250) / uint8(len(themes))
|
||||
|
||||
for tid, theme := range themes {
|
||||
|
|
Reference in a new issue