mirror of
https://gitlab.dit.htwk-leipzig.de/htwk-software/htwkalender-pwa.git
synced 2025-08-03 10:19:16 +02:00
added new ical event description
This commit is contained in:
@@ -4,7 +4,6 @@ import (
|
||||
"github.com/labstack/echo/v5"
|
||||
"github.com/pocketbase/pocketbase"
|
||||
"htwkalender/service/db"
|
||||
"unicode"
|
||||
)
|
||||
|
||||
func GetModulesForCourseDistinct(app *pocketbase.PocketBase, c echo.Context, course string, semester string) error {
|
||||
@@ -22,7 +21,7 @@ func GetModulesForCourseDistinct(app *pocketbase.PocketBase, c echo.Context, cou
|
||||
func replaceEmptyEntryInStringArray(modules []string, replacement string) {
|
||||
//replace empty string with "Sonderveranstaltungen"
|
||||
for i, module := range modules {
|
||||
if checkIfOnlyWhitespace(module) {
|
||||
if db.CheckIfOnlyWhitespace(module) {
|
||||
modules[i] = replacement
|
||||
}
|
||||
}
|
||||
@@ -34,22 +33,12 @@ func replaceEmptyEntry(modules []struct {
|
||||
}, replacement string) {
|
||||
//replace empty string with "Sonderveranstaltungen"
|
||||
for i, module := range modules {
|
||||
if checkIfOnlyWhitespace(module.Name) {
|
||||
if db.CheckIfOnlyWhitespace(module.Name) {
|
||||
modules[i].Name = replacement
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// check if course is empty or contains only whitespaces
|
||||
func checkIfOnlyWhitespace(word string) bool {
|
||||
for _, letter := range word {
|
||||
if !unicode.IsSpace(letter) || !(letter == int32(160)) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func GetAllModulesDistinct(app *pocketbase.PocketBase, c echo.Context) error {
|
||||
modules, err := db.GetAllModulesDistinct(app)
|
||||
|
||||
|
Reference in New Issue
Block a user