Personenliste fertig

This commit is contained in:
Simon Martens
2025-02-23 12:23:42 +01:00
parent 9c15836e7d
commit d8a01bfffb
16 changed files with 471 additions and 343 deletions

View File

@@ -1,6 +1,8 @@
package dbmodels
import (
"strings"
"github.com/pocketbase/pocketbase/core"
)
@@ -64,6 +66,35 @@ func (a *Agent) Profession() string {
return a.GetString(AGENTS_PROFESSION_FIELD)
}
func (a *Agent) ProfessionArray() []string {
profession := a.Profession()
if profession == "" {
return []string{}
}
ret := []string{}
profarr := strings.Split(profession, " ")
for _, p := range profarr {
if p == "" {
continue
}
plow := strings.ToLower(p)
if strings.Contains(plow, "text") {
ret = append(ret, "Text")
} else if strings.Contains(plow, "musik") {
ret = append(ret, "Musik")
} else if strings.Contains(plow, "graphik") {
ret = append(ret, "Graphik")
} else if strings.Contains(plow, "hrsg") {
ret = append(ret, "Hrsg")
} else if strings.Contains(plow, "sonst") {
ret = append(ret, "Sonst")
}
}
return ret
}
func (a *Agent) SetProfession(profession string) {
a.Set(AGENTS_PROFESSION_FIELD, profession)
}