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

Fix terminology

parent 10c43d74
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 #3390 passed
...@@ -106,21 +106,21 @@ class LessonDocumentation(ExtensibleModel): ...@@ -106,21 +106,21 @@ class LessonDocumentation(ExtensibleModel):
verbose_name=_("Group note"), max_length=200, blank=True verbose_name=_("Group note"), max_length=200, blank=True
) )
def _take_over_data(self): def _carry_over_data(self):
"""Take over data to the next lesson, if exists and data are not already set. """Carry over data to the next lesson, if exists and data are not already set.
Can be deactivated using site preference ``alsijil__take_over_double``. Can be deactivated using site preference ``alsijil__carry_over``.
""" """
if get_site_preferences()["alsijil__take_over_double"] and ( if get_site_preferences()["alsijil__carry_over"] and (
self.topic or self.homework or self.group_note self.topic or self.homework or self.group_note
): ):
try: try:
second_lesson = LessonPeriod.objects.get( 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=self.lesson_period.period.period + 1, period__period=self.lesson_period.period.period + 1,
) )
lesson_documentation = second_lesson.get_or_create_lesson_documentation( lesson_documentation = second_period.get_or_create_lesson_documentation(
CalendarWeek( CalendarWeek(
week=self.week, week=self.week,
year=self.lesson_period.lesson.get_year(self.week), year=self.lesson_period.lesson.get_year(self.week),
...@@ -144,11 +144,11 @@ class LessonDocumentation(ExtensibleModel): ...@@ -144,11 +144,11 @@ class LessonDocumentation(ExtensibleModel):
if changed: if changed:
lesson_documentation.save() lesson_documentation.save()
except LessonPeriod.DoesNotExist: except LessonPeriod.DoesNotExist:
# Do nothing if it's a single lesson # Do nothing if it's a single period
pass pass
def save(self, *args, **kwargs): def save(self, *args, **kwargs):
self._take_over_data() self._carry_over_data()
super().save(*args, **kwargs) super().save(*args, **kwargs)
class Meta: class Meta:
......
...@@ -17,13 +17,13 @@ class BlockPersonalNotesForCancelled(BooleanPreference): ...@@ -17,13 +17,13 @@ class BlockPersonalNotesForCancelled(BooleanPreference):
@site_preferences_registry.register @site_preferences_registry.register
class TakeOverDataForDoubleLessons(BooleanPreference): class CarryOverDataToNextPeriods(BooleanPreference):
section = alsijil section = alsijil
name = "take_over_double" name = "carry_over"
default = True default = True
verbose_name = _( verbose_name = _(
"Take over data from first lesson for second lesson in double lessons" "Carry over data from first lesson period to the following lesson periods in lessons over multiple periods"
) )
help_text = _( help_text = _(
"This will take over data only if the data in the second lesson are empty." "This will carry over data only if the data in the following periods are empty."
) )
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