Merge branch 'main' into 11-enhanced-module-titles

# Conflicts:
#	backend/model/eventModel.go
#	backend/service/fetch/fetchSeminarEventService.go
This commit is contained in:
masterelmar
2023-10-30 13:57:16 +01:00
15 changed files with 706 additions and 84 deletions

View File

@@ -9,7 +9,7 @@ import (
"github.com/jordic/goics"
)
// local type for EmitICal function
// IcalModel local type for EmitICal function
type IcalModel struct {
Events model.Events
Mapping []model.FeedCollection
@@ -17,7 +17,7 @@ type IcalModel struct {
// EmitICal implements the interface for goics
func (icalModel IcalModel) EmitICal() goics.Componenter {
layout := "2006-01-02 15:04:05 -0700 MST"
europeTime, _ := time.LoadLocation("Europe/Berlin")
c := goics.NewComponent()
c.SetType("VCALENDAR")
c.AddProperty("VERSION", "2.0")
@@ -29,11 +29,9 @@ func (icalModel IcalModel) EmitICal() goics.Componenter {
for _, event := range icalModel.Events {
s := goics.NewComponent()
s.SetType("VEVENT")
timeEnd, _ := time.Parse(layout, event.End)
timeStart, _ := time.Parse(layout, event.Start)
k, v := goics.FormatDateTime("DTEND;TZID=Europe/Berlin", timeEnd)
k, v := goics.FormatDateTime("DTEND;TZID=Europe/Berlin", event.End.Time().Local().In(europeTime))
s.AddProperty(k, v)
k, v = goics.FormatDateTime("DTSTART;TZID=Europe/Berlin", timeStart)
k, v = goics.FormatDateTime("DTSTART;TZID=Europe/Berlin", event.Start.Time().Local().In(europeTime))
s.AddProperty(k, v)
s.AddProperty("SUMMARY", replaceNameIfUserDefined(&event, icalModel.Mapping))
s.AddProperty("DESCRIPTION", generateDescription(event))