From 60d8e8042caec4c6efb7de1d4c421c4ed1fc7cae Mon Sep 17 00:00:00 2001 From: Rup-Narayan-Rajbanshi Date: Fri, 22 Sep 2023 10:45:16 +0545 Subject: [PATCH] Add filter is_parent for assessment-registry issues. --- apps/assessment_registry/filters.py | 8 ++++++++ schema.graphql | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/apps/assessment_registry/filters.py b/apps/assessment_registry/filters.py index 4e601d7e14..b078ec6162 100644 --- a/apps/assessment_registry/filters.py +++ b/apps/assessment_registry/filters.py @@ -63,6 +63,7 @@ class AssessmentRegistryIssueGQFilterSet(django_filters.FilterSet): sub_pillar = SimpleInputFilter(AssessmentRegistrySummarySubPillarTypeEnum) sub_dimension = SimpleInputFilter(AssessmentRegistrySummarySubDimensionTypeEnum) search = django_filters.CharFilter(method='filter_assessment_registry_issues') + is_parent = django_filters.BooleanFilter(method='filter_is_parent') class Meta: model = SummaryIssue @@ -74,3 +75,10 @@ def filter_assessment_registry_issues(self, qs, name, value): return qs.filter( label__icontains=value ) + + def filter_is_parent(self, qs, name, value): + if not value: + return qs + return qs.filter( + parent__isnull=True + ) diff --git a/schema.graphql b/schema.graphql index a458ad8ba8..6647bfb57f 100644 --- a/schema.graphql +++ b/schema.graphql @@ -3487,7 +3487,7 @@ type PublicProjectWithMembershipData { type Query { assessmentRegSummaryIssue(id: ID!): AssessmentRegistrySummaryIssueType - assessmentRegSummaryIssues(label: String, parent: ID, subPillar: AssessmentRegistrySummarySubPillarTypeEnum, subDimension: AssessmentRegistrySummarySubDimensionTypeEnum, search: String, page: Int = 1, ordering: String, pageSize: Int): AssessmentRegistrySummaryIssueListType + assessmentRegSummaryIssues(label: String, parent: ID, subPillar: AssessmentRegistrySummarySubPillarTypeEnum, subDimension: AssessmentRegistrySummarySubDimensionTypeEnum, search: String, isParent: Boolean, page: Int = 1, ordering: String, pageSize: Int): AssessmentRegistrySummaryIssueListType deepExploreStats(filter: ExploreDeepFilterInputType!): ExploreDashboardStatType publicDeepExploreYearlySnapshots: [PublicExploreSnapshotType!] publicDeepExploreGlobalSnapshots: [PublicExploreSnapshotType!]