Fixed event merging bug

This commit is contained in:
Maximilian Giller 2020-05-08 10:10:31 +02:00
parent b7ede5a026
commit eaa3de9d79

View file

@ -3,6 +3,7 @@ from datetime import datetime, timezone, timedelta, date
from dateutil.rrule import rrulestr
from dateutil.parser import parse
import calendar
from CalendarEvent import CalendarEvent
class CalendarInterface (DataSourceInterface):
@ -135,11 +136,31 @@ class CalendarInterface (DataSourceInterface):
raise ex
def __merge_event_data__(self, event, start=None):
if start is not None:
event.begin_datetime = start
event.end_datetime = start + event.duration
merged_event = CalendarEvent()
return event
merged_event.begin_datetime = event.begin_datetime
merged_event.end_datetime = event.end_datetime
merged_event.duration = event.duration
merged_event.allday = event.allday
merged_event.multiday = event.multiday
merged_event.rrule = event.rrule
merged_event.title = event.title
merged_event.description = event.description
merged_event.attendees = event.attendees
merged_event.highlight = event.highlight
merged_event.calendar_name = event.calendar_name
merged_event.calendar_url = event.calendar_url
merged_event.location = event.location
merged_event.fetch_datetime = event.fetch_datetime
if start is not None:
merged_event.begin_datetime = start
merged_event.end_datetime = start + event.duration
return merged_event
def __add_timezoneawarness__(self, rrule):
"""UNTIL must be specified in UTC when DTSTART is timezone-aware (which it is)"""