Performance issue #336

Closed
opened 2024-11-22 12:31:41 +01:00 by hansegucker · 4 comments
Owner
    @staticmethod
    def resolve_notes_with_extra_mark(root: ParticipationStatus, info, **kwargs):
        return NewPersonalNote.objects.filter(
            person=root.person,
            documentation=root.related_documentation,
            extra_mark__isnull=False,
        )

    @staticmethod
    def resolve_notes_with_note(root: ParticipationStatus, info, **kwargs):
        return NewPersonalNote.objects.filter(
            person=root.person,
            documentation=root.related_documentation,
            note__isnull=False,
        ).exclude(note="")
  • Move to documentation, permission check, use prefetch_related/optimizer, filter in frontend
  • try to annotate permission checks
  • Remove canDelete from query
       existing_documentations = Documentation.objects.filter(
            datetime_start__lte=datetime_end,
            datetime_end__gte=datetime_start,
            amends__in=[e["REFERENCE_OBJECT"] for e in events],
        ).prefetch_related("participations")
  • Prefetch participations__person and participations__absence_reason
``` @staticmethod def resolve_notes_with_extra_mark(root: ParticipationStatus, info, **kwargs): return NewPersonalNote.objects.filter( person=root.person, documentation=root.related_documentation, extra_mark__isnull=False, ) @staticmethod def resolve_notes_with_note(root: ParticipationStatus, info, **kwargs): return NewPersonalNote.objects.filter( person=root.person, documentation=root.related_documentation, note__isnull=False, ).exclude(note="") ``` - [x] Move to documentation, permission check, use `prefetch_related`/optimizer, filter in frontend - [ ] try to annotate permission checks - [x] Remove `canDelete` from query ```python existing_documentations = Documentation.objects.filter( datetime_start__lte=datetime_end, datetime_end__gte=datetime_start, amends__in=[e["REFERENCE_OBJECT"] for e in events], ).prefetch_related("participations") ``` - [x] Prefetch `participations__person` and `participations__absence_reason`
Author
Owner

assigned to @hansegucker

assigned to @hansegucker
Author
Owner

marked the checklist item Move to documentation, permission check, use prefetch_related/optimizer, filter in frontend as completed

marked the checklist item **Move to documentation, permission check, use `prefetch_related`/optimizer, filter in frontend** as completed
Author
Owner

marked the checklist item Remove canDelete from query as completed

marked the checklist item **Remove `canDelete` from query** as completed
Author
Owner

marked the checklist item Prefetch participations__person and participations__absence_reason as completed

marked the checklist item **Prefetch `participations__person` and `participations__absence_reason`** as completed
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
aleksis/AlekSIS-App-Alsijil#336
No description provided.