From 305fc1989511bd78ee9f0b374ad04a4d9d1348e2 Mon Sep 17 00:00:00 2001 From: Julian Leucker <leuckerj@gmail.com> Date: Thu, 12 Sep 2024 14:08:33 +0200 Subject: [PATCH] Add field person to StatisticsByPersonType --- aleksis/apps/alsijil/schema/statistics.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/aleksis/apps/alsijil/schema/statistics.py b/aleksis/apps/alsijil/schema/statistics.py index 4efe5e70a..d7f89e0f9 100644 --- a/aleksis/apps/alsijil/schema/statistics.py +++ b/aleksis/apps/alsijil/schema/statistics.py @@ -34,6 +34,7 @@ class ExtraMarkWithCountType(graphene.ObjectType): class StatisticsByPersonType(graphene.ObjectType): + person = graphene.Field(PersonType) participation_count = graphene.Int() absence_count = graphene.Int() absence_reasons = graphene.List(AbsenceReasonWithCountType) @@ -41,6 +42,10 @@ class StatisticsByPersonType(graphene.ObjectType): tardiness_count = graphene.Int() extra_marks = graphene.List(ExtraMarkWithCountType) + @staticmethod + def resolve_person(root: Person, info): + return root + def resolve_absence_reasons(root, info): return [ dict(absence_reason=reason, count=getattr(root, reason.count_label)) -- GitLab