admin/sync: remove old exercices no more in tree

This commit is contained in:
nemunaire 2017-12-12 16:54:32 +01:00
parent a89de24ad0
commit d965aab14a

View File

@ -2,6 +2,7 @@ package sync
import (
"fmt"
"log"
"path"
"strings"
"strconv"
@ -84,6 +85,19 @@ func SyncExercices(i Importer, theme fic.Theme) []string {
}
}
}
// Remove old exercices
if exercices, err := theme.GetExercices(); err == nil {
log.Println(emap)
for _, ex := range exercices {
if _, ok := emap[ex.Title]; !ok {
log.Println(ok)
ex.Delete()
} else {
log.Println(ok)
}
}
}
}
return errs
}