Fixed mutliday bug in day-view design

This commit is contained in:
Maximilian Giller 2019-04-29 18:47:47 +02:00
parent 69f12de1e5
commit 6504851aa1
2 changed files with 2 additions and 5 deletions

View file

@ -115,14 +115,10 @@ class DayViewPanel (PanelDesign):
if self.__is_today__(event.begin_datetime):
today = date.today()
tzinfo = event.end_datetime.tzinfo
event.end_datetime = datetime(today.year, today.month, today.day, 0, 0, 0, 0, tzinfo) + timedelta(1)
event.duration = timedelta(0, 0, 0, 0, event.begin_datetime.minute, event.begin_datetime.hour)
timed_ev.append(event)
elif self.__is_today__(event.end_datetime):
today = date.today()
tzinfo = event.begin_datetime.tzinfo
event.begin_datetime = datetime(today.year, today.month, today.day, 0, 0, 0, 0, tzinfo)
event.duration = timedelta(0, 0, 0, 0, event.end_datetime.minute, event.end_datetime.hour)
timed_ev.append(event)
else:
allday_ev.append(event)

View file

@ -28,6 +28,7 @@ class HourListDesign (DesignEntity):
def add_events (self, events):
self.events.extend(events)
self.events.sort(key=lambda x : x.begin_datetime)
def __finish_image__ (self):
self.number_columns = self.__get_max_num_simultaneous_events__()
@ -158,7 +159,7 @@ class HourListDesign (DesignEntity):
current_parallelity = 1
preceding = self.events[:index] #Assumption: Events are ordered chronologically
for pre_event in preceding:
if self.__are_simultaneous__(event, pre_event):
if self.__are_simultaneous__(pre_event, event):
current_parallelity += 1
if parallelity_count < current_parallelity:
parallelity_count = current_parallelity