Skip to content
Snippets Groups Projects
Verified Commit e370a171 authored by Nik | Klampfradler's avatar Nik | Klampfradler
Browse files

Document injected methods.

parent 38a57f20
No related branches found
No related tags found
No related merge requests found
...@@ -12,6 +12,19 @@ from .models import PersonalNote ...@@ -12,6 +12,19 @@ from .models import PersonalNote
@Person.method @Person.method
def mark_absent(self, day: date, starting_period: Optional[int] = 0, absent=True, excused=False): def mark_absent(self, day: date, starting_period: Optional[int] = 0, absent=True, excused=False):
""" Mark a person absent for all lessons in a day, optionally starting with
a selected period number.
This function creates `PersonalNote` objects for every `LessonPeriod` the person
participates in on the selected day and marks them as absent/excused.
..note:: Only available when BiscuIT-App-Alsijil is installed.
:Date: 2019-11-10
:Authors:
- Dominik George <dominik.george@teckids.org>
"""
wanted_week = CalendarWeek.from_date(day) wanted_week = CalendarWeek.from_date(day)
# Get all lessons of this person on the specified day # Get all lessons of this person on the specified day
...@@ -36,6 +49,18 @@ def mark_absent(self, day: date, starting_period: Optional[int] = 0, absent=True ...@@ -36,6 +49,18 @@ def mark_absent(self, day: date, starting_period: Optional[int] = 0, absent=True
@LessonPeriod.method @LessonPeriod.method
def get_personal_notes(self, wanted_week: CalendarWeek): def get_personal_notes(self, wanted_week: CalendarWeek):
""" Get all personal notes for that lesson in a specified week.
Returns all linked `PersonalNote` objects, filtered by the given weeek,
creating those objects that haven't been created yet.
..note:: Only available when BiscuIT-App-Alsijil is installed.
:Date: 2019-11-09
:Authors:
- Dominik George <dominik.george@teckids.org>
"""
# Find all persons in the associated groups that do not yet have a personal note for this lesson # Find all persons in the associated groups that do not yet have a personal note for this lesson
missing_persons = Person.objects.annotate( missing_persons = Person.objects.annotate(
no_personal_notes=~Exists(PersonalNote.objects.filter( no_personal_notes=~Exists(PersonalNote.objects.filter(
......
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