feat:#57 fixed bug

This commit is contained in:
Elmar Kresse
2024-10-07 20:50:00 +02:00
parent 8d0657acec
commit 8e9976e607
7 changed files with 717 additions and 17 deletions

View File

@@ -146,3 +146,17 @@ func GetAllCoursesForSemesterWithEvents(app *pocketbase.PocketBase, semester str
return courseArray, nil
}
func FindCourseByCourseName(app *pocketbase.PocketBase, courseName string) (model.SeminarGroup, error) {
var course SeminarGroup
// get the course by its name
err := app.Dao().DB().Select("*").From("groups").Where(dbx.NewExp("course = {:course}", dbx.Params{"course": courseName})).One(&course)
if err != nil {
slog.Error("Error while getting group from database: ", "error", err)
return model.SeminarGroup{}, err
}
return course.toSeminarGroupModel(), nil
}