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): ...@@ -171,24 +171,11 @@ class Documentation(CalendarEvent):
doc = next(existing_documentations_event, None) doc = next(existing_documentations_event, None)
if doc: if doc:
if ( if (incomplete and doc.topic) or (
(incomplete and doc.topic) absences_exist
or ( and (
not request.user.has_perm( not doc.participations.all()
"alsijil.edit_participation_status_for_documentation_rule", doc or not [d for d in doc.participations.all() if d.absence_reason]
)
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]
)
) )
): ):
continue continue
......
...@@ -108,7 +108,9 @@ class DocumentationType(PermissionsTypeMixin, DjangoFilterMixin, DjangoObjectTyp ...@@ -108,7 +108,9 @@ class DocumentationType(PermissionsTypeMixin, DjangoFilterMixin, DjangoObjectTyp
"alsijil.view_participation_status_for_documentation_rule", root "alsijil.view_participation_status_for_documentation_rule", root
): ):
if has_person(info.context.user): 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 []
return root.participations.all() 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