fixed db query and scheduled update process

This commit is contained in:
masterelmar
2023-10-08 20:44:07 +02:00
parent e8a94bdff4
commit 60eb4e34f6
3 changed files with 11 additions and 3 deletions

View File

@@ -105,9 +105,17 @@ func UpdateModulesForCourse(app *pocketbase.PocketBase, course string) error {
//get all events for the course and the semester
events, err := db.GetAllModulesForCourse(app, course, "ws")
if err != nil {
return apis.NewNotFoundError("Events could not be found", err)
return apis.NewNotFoundError("Events for winter semester could not be found", err)
}
// append all events for the course and the semester to the events array for ss
summerEvents, err := db.GetAllModulesForCourse(app, course, "ss")
if err != nil {
return apis.NewNotFoundError("Events for summer semester could not be found", err)
}
events = append(events, summerEvents...)
//if there are no events in the database, save the new events
if len(events) == 0 {
_, dbError = db.SaveEvents(seminarGroups, collection, app)