diff --git a/Calendar/DayViewPanel.py b/Calendar/DayViewPanel.py index 17c3b3b..6ff4634 100644 --- a/Calendar/DayViewPanel.py +++ b/Calendar/DayViewPanel.py @@ -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) diff --git a/Calendar/HourListDesign.py b/Calendar/HourListDesign.py index 7f53d28..24a4afc 100644 --- a/Calendar/HourListDesign.py +++ b/Calendar/HourListDesign.py @@ -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