mirror of
https://gitlab.dit.htwk-leipzig.de/htwk-software/htwkalender.git
synced 2026-01-16 19:42:26 +01:00
update for frontend
This commit is contained in:
@@ -113,3 +113,23 @@ func GetPlanForCourseAndSemester(app *pocketbase.PocketBase, course string, seme
|
||||
}
|
||||
return events
|
||||
}
|
||||
|
||||
func GetAllModulesForCourse(app *pocketbase.PocketBase, course string, semester string) ([]string, error) {
|
||||
var events []struct {
|
||||
Name string `db:"Name" json:"Name"`
|
||||
}
|
||||
|
||||
var eventArray []string
|
||||
|
||||
// get all events from event records in the events collection
|
||||
err := app.Dao().DB().Select("Name").From("events").Where(dbx.NewExp("course = {:course} AND semester = {:semester}", dbx.Params{"course": course, "semester": semester})).Distinct(true).All(&events)
|
||||
if err != nil {
|
||||
print("Error while getting events from database: ", err)
|
||||
return eventArray, err
|
||||
}
|
||||
|
||||
for _, event := range events {
|
||||
eventArray = append(eventArray, event.Name)
|
||||
}
|
||||
return eventArray, nil
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ func SaveGroups(seminarGroup []model.SeminarGroup, collection *models.Collection
|
||||
func GetAllCourses(app *pocketbase.PocketBase) []string {
|
||||
|
||||
var courses []struct {
|
||||
Rooms string `db:"course" json:"course"`
|
||||
CourseShortcut string `db:"course" json:"course"`
|
||||
}
|
||||
|
||||
// get all rooms from event records in the events collection
|
||||
@@ -37,8 +37,8 @@ func GetAllCourses(app *pocketbase.PocketBase) []string {
|
||||
|
||||
var courseArray []string
|
||||
|
||||
for _, room := range courses {
|
||||
courseArray = append(courseArray, room.Rooms)
|
||||
for _, course := range courses {
|
||||
courseArray = append(courseArray, course.CourseShortcut)
|
||||
}
|
||||
|
||||
return courseArray
|
||||
|
||||
Reference in New Issue
Block a user