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

Merge branch '73-add-rules-and-permissions' into feature/performance-optimizations

parents 82107ae6 091caa94
No related branches found
No related tags found
1 merge request!90Performance optimizations
Pipeline #4038 failed
...@@ -55,16 +55,20 @@ def mark_absent( ...@@ -55,16 +55,20 @@ def mark_absent(
continue continue
with reversion.create_revision(): with reversion.create_revision():
personal_note, created = PersonalNote.objects.update_or_create( personal_note, created = (
person=self, PersonalNote.objects.select_related(None)
lesson_period=lesson_period, .prefetch_related(None)
week=wanted_week.week, .update_or_create(
year=wanted_week.year, person=self,
defaults={ lesson_period=lesson_period,
"absent": absent, week=wanted_week.week,
"excused": excused, year=wanted_week.year,
"excuse_type": excuse_type, defaults={
}, "absent": absent,
"excused": excused,
"excuse_type": excuse_type,
},
)
) )
personal_note.groups_of_person.set(self.member_of.all()) personal_note.groups_of_person.set(self.member_of.all())
...@@ -120,11 +124,17 @@ def get_personal_notes(self, persons: QuerySet, wanted_week: CalendarWeek): ...@@ -120,11 +124,17 @@ def get_personal_notes(self, persons: QuerySet, wanted_week: CalendarWeek):
for personal_note in new_personal_notes: for personal_note in new_personal_notes:
personal_note.groups_of_person.set(personal_note.person.member_of.all()) personal_note.groups_of_person.set(personal_note.person.member_of.all())
return PersonalNote.objects.filter( return (
lesson_period=self, PersonalNote.objects.filter(
week=wanted_week.week, lesson_period=self,
year=wanted_week.year, week=wanted_week.week,
person__in=persons, year=wanted_week.year,
person__in=persons,
)
.select_related(None)
.prefetch_related(None)
.select_related("person", "excuse_type")
.prefetch_related("extra_marks")
) )
......
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