Skip to content
Snippets Groups Projects
Commit 8388f25d authored by Julian's avatar Julian Committed by permcu
Browse files

Create participations when creating documentations

parent 54b1a660
No related branches found
No related tags found
1 merge request!361Resolve "Add statistics page for absences"
Pipeline #188393 failed
......@@ -678,6 +678,24 @@ class Documentation(CalendarEvent):
)
obj.teachers.set(teachers.all())
obj.save()
# Create Participation Statuses
# Cannot use djangos bulk_create method, as then the save method of the
# superclass wouldn't be called
for member in lesson_event.all_members:
# TODO: Check for preexisting absences in kolego
# TODO: maybe only create if the lesson start is in the past
status = ParticipationStatus.objects.create(
person=member,
related_documentation=obj,
datetime_start=datetime_start,
datetime_end=datetime_end,
timezone=lesson_event.timezone,
)
status.groups_of_person.set(member.member_of.all())
status.save()
return obj
@classmethod
......
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