mirror of
https://gitlab.dit.htwk-leipzig.de/htwk-software/htwkalender.git
synced 2025-08-02 17:59:14 +02:00
feat:#52 added new fetcher from new endpoint
This commit is contained in:
@@ -6,7 +6,7 @@ import (
|
||||
"github.com/pocketbase/pocketbase/apis"
|
||||
"htwkalender/model"
|
||||
"htwkalender/service/db"
|
||||
"htwkalender/service/fetch"
|
||||
"htwkalender/service/fetch/v1"
|
||||
"htwkalender/service/functions"
|
||||
)
|
||||
|
||||
@@ -95,11 +95,11 @@ func UpdateModulesForCourse(app *pocketbase.PocketBase, course string) error {
|
||||
var courses []string
|
||||
courses = append(courses, course)
|
||||
|
||||
seminarGroups := fetch.GetSeminarGroupsEventsFromHTML(courses)
|
||||
seminarGroups := v1.GetSeminarGroupsEventsFromHTML(courses)
|
||||
|
||||
seminarGroups = fetch.ClearEmptySeminarGroups(seminarGroups)
|
||||
seminarGroups = v1.ClearEmptySeminarGroups(seminarGroups)
|
||||
|
||||
seminarGroups = fetch.ReplaceEmptyEventNames(seminarGroups)
|
||||
seminarGroups = v1.ReplaceEmptyEventNames(seminarGroups)
|
||||
|
||||
//check if events in the seminarGroups Events are already in the database
|
||||
//if yes, keep the database as it is
|
||||
@@ -122,7 +122,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, app)
|
||||
_, dbError := db.SaveSeminarGroupEvents(seminarGroups, app)
|
||||
if dbError != nil {
|
||||
return apis.NewNotFoundError("Events could not be saved", dbError)
|
||||
}
|
||||
@@ -148,7 +148,7 @@ func UpdateModulesForCourse(app *pocketbase.PocketBase, course string) error {
|
||||
}
|
||||
|
||||
//save the new events
|
||||
_, dbError := db.SaveEvents(seminarGroups, app)
|
||||
_, dbError := db.SaveSeminarGroupEvents(seminarGroups, app)
|
||||
if dbError != nil {
|
||||
return apis.NewNotFoundError("Events could not be saved", dbError)
|
||||
}
|
||||
|
Reference in New Issue
Block a user