Skip to content
Snippets Groups Projects

Resolve "Lessons doesn't get cancelled by events in "My timetable""

3 files
+ 14
4
Compare changes
  • Side-by-side
  • Inline
Files
3
@@ -34,7 +34,7 @@ def build_timetable(
type_ = obj.timetable_type
is_week = False
if type(date_ref) == CalendarWeek:
if isinstance(date_ref, CalendarWeek):
is_week = True
if type_ is None:
@@ -361,17 +361,22 @@ def build_timetable(
continue
events_for_this_period = events_per_period.get(period, [])
events_for_replacement_for_this_period = events_for_replacement_per_period.get(
period, []
)
lesson_periods_for_this_period = lesson_periods_per_period.get(period, [])
# Add lesson periods
if lesson_periods_for_this_period:
if events_for_this_period:
if events_for_replacement_for_this_period:
# If there is a event in this period,
# we have to check whether the actual lesson is taking place.
lesson_periods_to_keep = []
for lesson_period in lesson_periods_for_this_period:
if not lesson_period.is_replaced_by_event(events_for_this_period):
if not lesson_period.is_replaced_by_event(
events_for_replacement_for_this_period
):
lesson_periods_to_keep.append(lesson_period)
col += lesson_periods_to_keep
else:
Loading