sync: Fix a div by 0 when no exercice detected in theme
This commit is contained in:
parent
7e13cf28bd
commit
867e9bb345
@ -5,8 +5,8 @@ import (
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"time"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"srs.epita.fr/fic-server/libfic"
|
||||
"srs.epita.fr/fic-server/settings"
|
||||
@ -48,12 +48,14 @@ func SpeedySyncDeep(i Importer) (errs map[string][]string) {
|
||||
errs[theme.Name] = SyncExercices(i, theme)
|
||||
|
||||
if exercices, err := theme.GetExercices(); err == nil {
|
||||
if len(exercices) == 0 {
|
||||
continue
|
||||
}
|
||||
var exerciceStep uint8 = themeStep / uint8(len(exercices))
|
||||
for eid, exercice := range exercices {
|
||||
log.Printf("Deep synchronization in progress: %d/255 - doing Theme %q, Exercice %q: %q\n", DeepSyncProgress, theme.Name, exercice.Title, exercice.Path)
|
||||
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
|
||||
errs[theme.Name] = append(errs[theme.Name], SyncExerciceFiles(i, exercice)...)
|
||||
|
||||
DeepSyncProgress += exerciceStep / 2
|
||||
_, ferrs := SyncExerciceFlags(i, exercice)
|
||||
|
Loading…
x
Reference in New Issue
Block a user