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

Fix documentations from student perspective

parent 02704e20
No related branches found
No related tags found
1 merge request!433Optimize some queries
Pipeline #193724 failed
......@@ -171,24 +171,11 @@ class Documentation(CalendarEvent):
doc = next(existing_documentations_event, None)
if doc:
if (
(incomplete and doc.topic)
or (
not request.user.has_perm(
"alsijil.edit_participation_status_for_documentation_rule", doc
)
and not [
d
for d in doc.participations.all()
if d.absence_reason and d.person_id == request.user.person.id
]
)
or (
absences_exist
and (
not doc.participations.all()
or not [d for d in doc.participations.all() if d.absence_reason]
)
if (incomplete and doc.topic) or (
absences_exist
and (
not doc.participations.all()
or not [d for d in doc.participations.all() if d.absence_reason]
)
):
continue
......
......@@ -108,7 +108,9 @@ class DocumentationType(PermissionsTypeMixin, DjangoFilterMixin, DjangoObjectTyp
"alsijil.view_participation_status_for_documentation_rule", root
):
if has_person(info.context.user):
return root.participations.filter(person=info.context.user.person)
return [
p for p in root.participations.all() if p.person == info.context.user.person
]
return []
return root.participations.all()
......
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