-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add query for Assessment registry Count
- total assessment count - total stakeholder count - collection technique count - multisector and single sector assessment
- Loading branch information
Showing
4 changed files
with
168 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import django_filters | ||
|
||
from user_resource.filters import UserResourceGqlFilterSet | ||
from .models import AssessmentRegistry | ||
from utils.graphene.filters import IDListFilter | ||
|
||
|
||
class AssessmentDashboardFilterSet(UserResourceGqlFilterSet): | ||
search = django_filters.CharFilter(method="filter_title") | ||
stakeholder = IDListFilter(distinct=True) | ||
lead_organization = IDListFilter(distinct=True) | ||
location = IDListFilter(distinct=True) | ||
sector = IDListFilter(distinct=True) | ||
affected_group = IDListFilter(distinct=True) | ||
family = IDListFilter(distinct=True) | ||
frequency = IDListFilter(distinct=True) | ||
coordination_type = IDListFilter(distinct=True) | ||
|
||
class Meta: | ||
model = AssessmentRegistry | ||
fields = () | ||
|
||
def filter_search(self, qs, _, value): | ||
return qs if value is None else qs.filter(project__title=value) | ||
|
||
@property | ||
def qs(self): | ||
return super().qs.distinct() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters