Fixed event merging bug
This commit is contained in:
parent
b7ede5a026
commit
eaa3de9d79
1 changed files with 26 additions and 5 deletions
|
@ -3,6 +3,7 @@ from datetime import datetime, timezone, timedelta, date
|
||||||
from dateutil.rrule import rrulestr
|
from dateutil.rrule import rrulestr
|
||||||
from dateutil.parser import parse
|
from dateutil.parser import parse
|
||||||
import calendar
|
import calendar
|
||||||
|
from CalendarEvent import CalendarEvent
|
||||||
|
|
||||||
|
|
||||||
class CalendarInterface (DataSourceInterface):
|
class CalendarInterface (DataSourceInterface):
|
||||||
|
@ -135,11 +136,31 @@ class CalendarInterface (DataSourceInterface):
|
||||||
raise ex
|
raise ex
|
||||||
|
|
||||||
def __merge_event_data__(self, event, start=None):
|
def __merge_event_data__(self, event, start=None):
|
||||||
if start is not None:
|
merged_event = CalendarEvent()
|
||||||
event.begin_datetime = start
|
|
||||||
event.end_datetime = start + event.duration
|
|
||||||
|
|
||||||
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):
|
def __add_timezoneawarness__(self, rrule):
|
||||||
"""UNTIL must be specified in UTC when DTSTART is timezone-aware (which it is)"""
|
"""UNTIL must be specified in UTC when DTSTART is timezone-aware (which it is)"""
|
||||||
|
|
Loading…
Reference in a new issue