mirror of
https://gitlab.dit.htwk-leipzig.de/htwk-software/htwkalender-pwa.git
synced 2025-08-03 10:19:16 +02:00
refactor:#16 event saving shortened
This commit is contained in:
@@ -90,11 +90,6 @@ func UpdateModulesForCourse(app *pocketbase.PocketBase, course string) error {
|
||||
|
||||
seminarGroups := fetch.GetSeminarGroupsEventsFromHTML(courses)
|
||||
|
||||
collection, dbError := db.FindCollection(app, "events")
|
||||
if dbError != nil {
|
||||
return apis.NewNotFoundError("Collection not found", dbError)
|
||||
}
|
||||
|
||||
seminarGroups = fetch.ClearEmptySeminarGroups(seminarGroups)
|
||||
|
||||
seminarGroups = fetch.ReplaceEmptyEventNames(seminarGroups)
|
||||
@@ -120,7 +115,7 @@ func UpdateModulesForCourse(app *pocketbase.PocketBase, course string) error {
|
||||
|
||||
//if there are no events in the database, save the new events
|
||||
if len(events) == 0 {
|
||||
_, dbError = db.SaveEvents(seminarGroups, collection, app)
|
||||
_, dbError := db.SaveEvents(seminarGroups, app)
|
||||
if dbError != nil {
|
||||
return apis.NewNotFoundError("Events could not be saved", dbError)
|
||||
}
|
||||
@@ -146,7 +141,7 @@ func UpdateModulesForCourse(app *pocketbase.PocketBase, course string) error {
|
||||
}
|
||||
|
||||
//save the new events
|
||||
_, dbError = db.SaveEvents(seminarGroups, collection, app)
|
||||
_, dbError := db.SaveEvents(seminarGroups, app)
|
||||
if dbError != nil {
|
||||
return apis.NewNotFoundError("Events could not be saved", dbError)
|
||||
}
|
||||
|
Reference in New Issue
Block a user