diff --git a/aleksis/apps/alsijil/frontend/components/coursebook/absences/participationStatus.graphql b/aleksis/apps/alsijil/frontend/components/coursebook/absences/participationStatus.graphql index 61c486a7040e393eebe39ff5f6303f37e75a71da..abc66fe174b4760cd37c6c749a9d5207cef0cb0a 100644 --- a/aleksis/apps/alsijil/frontend/components/coursebook/absences/participationStatus.graphql +++ b/aleksis/apps/alsijil/frontend/components/coursebook/absences/participationStatus.graphql @@ -46,6 +46,10 @@ mutation touchDocumentation($documentationId: ID!) { id note } + noteWithTardiness { + id + tardiness + } isOptimistic } } diff --git a/aleksis/apps/alsijil/frontend/components/coursebook/coursebook.graphql b/aleksis/apps/alsijil/frontend/components/coursebook/coursebook.graphql index 2505ee24b1c50434f552fb8574e0627031ba73c7..985fa3acea5bfc1e56ee69939e6c7ac211c82c72 100644 --- a/aleksis/apps/alsijil/frontend/components/coursebook/coursebook.graphql +++ b/aleksis/apps/alsijil/frontend/components/coursebook/coursebook.graphql @@ -90,6 +90,10 @@ query documentationsForCoursebook( id note } + noteWithTardiness { + id + tardiness + } isOptimistic } topic diff --git a/aleksis/apps/alsijil/frontend/components/coursebook/personal_notes/personal_notes.graphql b/aleksis/apps/alsijil/frontend/components/coursebook/personal_notes/personal_notes.graphql index 014178c1326960f02dee24cf92f8eb5c679298f5..d5544e3e97b4ccbfe7fc58f434f680441edf06ae 100644 --- a/aleksis/apps/alsijil/frontend/components/coursebook/personal_notes/personal_notes.graphql +++ b/aleksis/apps/alsijil/frontend/components/coursebook/personal_notes/personal_notes.graphql @@ -5,6 +5,7 @@ query personalNotes($orderBy: [String], $filters: JSONString) { extraMark { id } + tardiness canEdit canDelete } @@ -18,6 +19,7 @@ mutation createPersonalNotes($input: [BatchCreatePersonalNoteInput]!) { extraMark { id } + tardiness canEdit canDelete } @@ -38,6 +40,7 @@ mutation updatePersonalNotes($input: [BatchPatchPersonalNoteInput]!) { extraMark { id } + tardiness canEdit canDelete } diff --git a/aleksis/apps/alsijil/schema/participation_status.py b/aleksis/apps/alsijil/schema/participation_status.py index ddff69e7c3e7631ea74132f6f42869c41a04e06e..173ddeaab757a0211036a0df1219999ad1a81cb3 100644 --- a/aleksis/apps/alsijil/schema/participation_status.py +++ b/aleksis/apps/alsijil/schema/participation_status.py @@ -31,6 +31,7 @@ class ParticipationStatusType( notes_with_extra_mark = graphene.List(PersonalNoteType) notes_with_note = graphene.List(PersonalNoteType) + note_with_tardiness = graphene.Field(PersonalNoteType(), required=False) @staticmethod def resolve_notes_with_extra_mark(root: ParticipationStatus, info, **kwargs): @@ -45,9 +46,21 @@ class ParticipationStatusType( return NewPersonalNote.objects.filter( person=root.person, documentation=root.related_documentation, - extra_mark__isnull=True, + note__isnull=False, ) + @staticmethod + def resolve_note_with_tardiness(root: ParticipationStatus, info, **kwargs): + notes = NewPersonalNote.objects.filter( + person=root.person, + documentation=root.related_documentation, + tardiness__isnull=False, + ) + if len(notes): + return notes.first() + + return None + class ParticipationStatusBatchPatchMutation(BaseBatchPatchMutation): class Meta: