From 932fa6500e52f5ca05066f418dddd2f1a1fa170a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Bedna=C5=99=C3=ADk?= <jan.bednarik@gmail.com> Date: Wed, 28 Feb 2018 23:44:28 +0100 Subject: [PATCH] Resolve total reports on Author type. --- openlobby/core/api/types.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/openlobby/core/api/types.py b/openlobby/core/api/types.py index b777ba2..d88698d 100644 --- a/openlobby/core/api/types.py +++ b/openlobby/core/api/types.py @@ -169,6 +169,9 @@ class Author(graphene.ObjectType): return ReportConnection(page_info=page_info, edges=edges, total_count=total) + def resolve_total_reports(self, info, **kwargs): + return models.Report.objects.filter(author_id=self.id, is_draft=False).count() + class LoginShortcut(graphene.ObjectType): name = graphene.String() -- GitLab