admin/sync: remove old exercices no more in tree
This commit is contained in:
parent
a89de24ad0
commit
d965aab14a
1 changed files with 14 additions and 0 deletions
|
@ -2,6 +2,7 @@ package sync
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"log"
|
||||||
"path"
|
"path"
|
||||||
"strings"
|
"strings"
|
||||||
"strconv"
|
"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
|
return errs
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue