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

Merge branch 'master' into 69-add-support-for-assinging-class-roles

parents 3a87c2f8 c4e64c53
No related branches found
No related tags found
1 merge request!131Resolve "Add support for assinging group roles"
Pipeline #5654 passed
...@@ -46,6 +46,14 @@ class CarryOverDataToNextPeriods(BooleanPreference): ...@@ -46,6 +46,14 @@ class CarryOverDataToNextPeriods(BooleanPreference):
help_text = _("This will carry over data only if the data in the following periods are empty.") help_text = _("This will carry over data only if the data in the following periods are empty.")
@site_preferences_registry.register
class CarryOverPersonalNotesToNextPeriods(BooleanPreference):
section = alsijil
name = "carry_over_personal_notes"
default = True
verbose_name = _("Carry over personal notes to all following lesson periods on the same day.")
@site_preferences_registry.register @site_preferences_registry.register
class AllowOpenPeriodsOnSameDay(BooleanPreference): class AllowOpenPeriodsOnSameDay(BooleanPreference):
section = alsijil section = alsijil
......
...@@ -75,7 +75,7 @@ ...@@ -75,7 +75,7 @@
<div class="col s12" id="week-overview"> <div class="col s12" id="week-overview">
{% regroup lesson_periods by period.get_weekday_display as periods_by_day %} {% regroup lesson_periods by period.get_weekday_display as periods_by_day %}
{% for weekday, periods in periods_by_day %} {% for weekday, periods in periods_by_day %}
{% with weekdays|get_dict:forloop.counter0 as advanced_weekday %} {% with weekdays|get_dict:periods.0.period.weekday as advanced_weekday %}
{% weekday_to_date week periods.0.period.weekday as current_date %} {% weekday_to_date week periods.0.period.weekday as current_date %}
{% if advanced_weekday.holiday and not request.site.preferences.alsijil__allow_entries_in_holidays %} {% if advanced_weekday.holiday and not request.site.preferences.alsijil__allow_entries_in_holidays %}
......
...@@ -169,17 +169,19 @@ def lesson( ...@@ -169,17 +169,19 @@ def lesson(
reversion.set_user(request.user) reversion.set_user(request.user)
instances = personal_note_formset.save() instances = personal_note_formset.save()
# Iterate over personal notes and carry changed absences to following lessons if get_site_preferences()["alsijil__carry_over_personal_notes"]:
with reversion.create_revision(): # Iterate over personal notes
reversion.set_user(request.user) # and carry changed absences to following lessons
for instance in instances: with reversion.create_revision():
instance.person.mark_absent( reversion.set_user(request.user)
wanted_week[lesson_period.period.weekday], for instance in instances:
lesson_period.period.period + 1, instance.person.mark_absent(
instance.absent, wanted_week[lesson_period.period.weekday],
instance.excused, lesson_period.period.period + 1,
instance.excuse_type, instance.absent,
) instance.excused,
instance.excuse_type,
)
messages.success(request, _("The personal notes have been saved.")) messages.success(request, _("The personal notes have been saved."))
......
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