added schedule for updating all modules

This commit is contained in:
Elmar Kresse
2023-10-01 13:30:19 +02:00
parent f982feec4f
commit f89416170d
7 changed files with 112 additions and 8 deletions

View File

@@ -28,9 +28,9 @@ func GetSeminarEvents(c echo.Context, app *pocketbase.PocketBase) error {
return apis.NewNotFoundError("Collection not found", dbError)
}
seminarGroups = clearEmptySeminarGroups(seminarGroups)
seminarGroups = ClearEmptySeminarGroups(seminarGroups)
seminarGroups = replaceEmptyEventNames(seminarGroups)
seminarGroups = ReplaceEmptyEventNames(seminarGroups)
savedRecords, dbError := db.SaveEvents(seminarGroups, collection, app)
@@ -41,7 +41,7 @@ func GetSeminarEvents(c echo.Context, app *pocketbase.PocketBase) error {
return c.JSON(http.StatusOK, savedRecords)
}
func replaceEmptyEventNames(groups []model.SeminarGroup) []model.SeminarGroup {
func ReplaceEmptyEventNames(groups []model.SeminarGroup) []model.SeminarGroup {
for i, group := range groups {
for j, event := range group.Events {
if event.Name == "" {
@@ -52,7 +52,7 @@ func replaceEmptyEventNames(groups []model.SeminarGroup) []model.SeminarGroup {
return groups
}
func clearEmptySeminarGroups(seminarGroups []model.SeminarGroup) []model.SeminarGroup {
func ClearEmptySeminarGroups(seminarGroups []model.SeminarGroup) []model.SeminarGroup {
var newSeminarGroups []model.SeminarGroup
for _, seminarGroup := range seminarGroups {
if len(seminarGroup.Events) > 0 && seminarGroup.Course != "" {