Skip to content
Snippets Groups Projects
Verified Commit 4b1e0a9c authored by Jonathan Weth's avatar Jonathan Weth :keyboard:
Browse files

Support triple, quadruple, ... periods in carry_over_data, too

parent ea2cc407
No related branches found
No related tags found
1 merge request!79Resolve "Carry over the data of the first lesson for double (or triple, ...) lessons"
Pipeline #3391 passed
...@@ -111,13 +111,13 @@ class LessonDocumentation(ExtensibleModel): ...@@ -111,13 +111,13 @@ class LessonDocumentation(ExtensibleModel):
Can be deactivated using site preference ``alsijil__carry_over``. Can be deactivated using site preference ``alsijil__carry_over``.
""" """
try: following_periods = LessonPeriod.objects.filter(
second_period = LessonPeriod.objects.get( lesson=self.lesson_period.lesson,
lesson=self.lesson_period.lesson, period__weekday=self.lesson_period.period.weekday,
period__weekday=self.lesson_period.period.weekday, period__period__gt=self.lesson_period.period.period,
period__period=self.lesson_period.period.period + 1, )
) for period in following_periods:
lesson_documentation = second_period.get_or_create_lesson_documentation( lesson_documentation = period.get_or_create_lesson_documentation(
CalendarWeek( CalendarWeek(
week=self.week, year=self.lesson_period.lesson.get_year(self.week), week=self.week, year=self.lesson_period.lesson.get_year(self.week),
) )
...@@ -139,9 +139,6 @@ class LessonDocumentation(ExtensibleModel): ...@@ -139,9 +139,6 @@ class LessonDocumentation(ExtensibleModel):
if changed: if changed:
lesson_documentation.save() lesson_documentation.save()
except LessonPeriod.DoesNotExist:
# Do nothing if it's a single period
pass
def save(self, *args, **kwargs): def save(self, *args, **kwargs):
if get_site_preferences()["alsijil__carry_over"] and ( if get_site_preferences()["alsijil__carry_over"] and (
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment