mirror of
https://gitlab.dit.htwk-leipzig.de/htwk-software/htwkalender.git
synced 2025-08-02 17:59:14 +02:00
fixed CustomName whitespace
This commit is contained in:
@@ -22,7 +22,7 @@ func GetModulesForCourseDistinct(app *pocketbase.PocketBase, c echo.Context, cou
|
||||
func replaceEmptyEntryInStringArray(modules []string, replacement string) {
|
||||
//replace empty functions with "Sonderveranstaltungen"
|
||||
for i, module := range modules {
|
||||
if functions.CheckIfOnlyWhitespace(module) {
|
||||
if functions.OnlyWhitespace(module) {
|
||||
modules[i] = replacement
|
||||
}
|
||||
}
|
||||
@@ -34,7 +34,7 @@ func replaceEmptyEntry(modules []struct {
|
||||
}, replacement string) {
|
||||
//replace empty functions with "Sonderveranstaltungen"
|
||||
for i, module := range modules {
|
||||
if functions.CheckIfOnlyWhitespace(module.Name) {
|
||||
if functions.OnlyWhitespace(module.Name) {
|
||||
modules[i].Name = replacement
|
||||
}
|
||||
}
|
||||
|
@@ -3,7 +3,7 @@ package functions
|
||||
import "unicode"
|
||||
|
||||
// check if course is empty or contains only whitespaces
|
||||
func CheckIfOnlyWhitespace(word string) bool {
|
||||
func OnlyWhitespace(word string) bool {
|
||||
for _, letter := range word {
|
||||
if !unicode.IsSpace(letter) || !(letter == int32(160)) {
|
||||
return false
|
||||
|
@@ -43,7 +43,7 @@ func (icalModel IcalModel) EmitICal() goics.Componenter {
|
||||
|
||||
func replaceNameIfUserDefined(name string, mapping []model.FeedCollection) string {
|
||||
for _, mapEntry := range mapping {
|
||||
if mapEntry.Name == name {
|
||||
if mapEntry.Name == name && !functions.OnlyWhitespace(mapEntry.UserDefinedName) {
|
||||
return mapEntry.UserDefinedName
|
||||
}
|
||||
}
|
||||
@@ -53,13 +53,13 @@ func replaceNameIfUserDefined(name string, mapping []model.FeedCollection) strin
|
||||
func generateDescription(event *model.Event) string {
|
||||
var description string
|
||||
|
||||
if !functions.CheckIfOnlyWhitespace(event.Notes) {
|
||||
if !functions.OnlyWhitespace(event.Notes) {
|
||||
description += "Notizen: " + event.Notes + "\n"
|
||||
}
|
||||
if !functions.CheckIfOnlyWhitespace(event.Prof) {
|
||||
if !functions.OnlyWhitespace(event.Prof) {
|
||||
description += "Prof: " + event.Prof + "\n"
|
||||
}
|
||||
if !functions.CheckIfOnlyWhitespace(event.Course) {
|
||||
if !functions.OnlyWhitespace(event.Course) {
|
||||
description += "Gruppe: " + event.Course + "\n"
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user