diff --git a/apps/assessment_registry/dashboard_schema.py b/apps/assessment_registry/dashboard_schema.py index 6db96f458e..e9a1d47ccd 100644 --- a/apps/assessment_registry/dashboard_schema.py +++ b/apps/assessment_registry/dashboard_schema.py @@ -7,21 +7,22 @@ from django.db.models import Count -class AssessmentCount(graphene.ObjectType): +class AssessmentCountType(graphene.ObjectType): coordinated_joint = graphene.Field(AssessmentRegistryCoordinationTypeEnum) coordinated_joint_display = graphene.String() count = graphene.Int() def resolve_coordinated_joint_display(self, info): - return AssessmentRegistry.CoordinationType(self.coordinated_joint).label + return AssessmentRegistry.CoordinationType( + self.coordinated_joint).label -class StakeholderCount(graphene.ObjectType): +class StakeholderCountType(graphene.ObjectType): stakeholder = graphene.String() count = graphene.Int() -class CollectionTechniqueCount(graphene.ObjectType): +class CollectionTechniqueCountType(graphene.ObjectType): data_collection_technique = graphene.Field( AssessmentRegistryDataCollectionTechniqueTypeEnum ) @@ -34,10 +35,10 @@ def resolve_data_collection_technique_display(self, info): ).label -class AssessmentDashboardStatistics(graphene.ObjectType): - assessment_count = graphene.List(AssessmentCount) - stakeholder_count = graphene.List(StakeholderCount) - collection_technique_count = graphene.List(CollectionTechniqueCount) +class AssessmentDashboardStatisticsType(graphene.ObjectType): + assessment_count = graphene.List(AssessmentCountType) + stakeholder_count = graphene.List(StakeholderCountType) + collection_technique_count = graphene.List(CollectionTechniqueCountType) model = AssessmentRegistry def resolve_assessment_count(self, info): @@ -48,7 +49,7 @@ def resolve_assessment_count(self, info): .order_by("coordinated_joint") ) return [ - AssessmentCount( + AssessmentCountType( coordinated_joint=assessment["coordinated_joint"], count=assessment["count"], ) @@ -63,7 +64,7 @@ def resolve_stakeholder_count(self, info): .order_by("lead_organizations") ) return [ - StakeholderCount( + StakeholderCountType( stakeholder=stakeholder["lead_organizations__title"], count=stakeholder["count"], ) @@ -80,7 +81,7 @@ def resolve_collection_technique_count(self, info): .order_by("data_collection_technique") ) return [ - CollectionTechniqueCount( + CollectionTechniqueCountType( data_collection_technique=technique["data_collection_technique"], count=technique["count"], ) @@ -90,8 +91,8 @@ def resolve_collection_technique_count(self, info): class Query: assessment_dashboard_statistics = graphene.Field( - AssessmentDashboardStatistics) + AssessmentDashboardStatisticsType) @staticmethod def resolve_assessment_dashboard_statistics(root, info, **kwargs): - return AssessmentDashboardStatistics + return AssessmentDashboardStatisticsType diff --git a/schema.graphql b/schema.graphql index b19a2239b5..8196db6ad1 100644 --- a/schema.graphql +++ b/schema.graphql @@ -483,6 +483,18 @@ type AnalyticalStatementType { entries: [AnalyticalStatementEntryType!] } +type AssessmentCountType { + coordinatedJoint: AssessmentRegistryCoordinationTypeEnum + coordinatedJointDisplay: String + count: Int +} + +type AssessmentDashboardStatisticsType { + assessmentCount: [AssessmentCountType] + stakeholderCount: [StakeholderCountType] + collectionTechniqueCount: [CollectionTechniqueCountType] +} + type AssessmentListType { results: [AssessmentType!] totalCount: Int @@ -1086,6 +1098,12 @@ type ChangeUserPassword { ok: Boolean } +type CollectionTechniqueCountType { + dataCollectionTechnique: AssessmentRegistryDataCollectionTechniqueTypeEnum + dataCollectionTechniqueDisplay: String + count: Int +} + enum ConnectorLeadExtractionStatusEnum { PENDING RETRYING @@ -2713,6 +2731,7 @@ type ProjectDetailType { organizations: [ProjectOrganizationType!] hasAnalysisFramework: Boolean! hasAssessmentTemplate: Boolean! + assessmentDashboardStatistics: AssessmentDashboardStatisticsType assessmentRegistry(id: ID!): AssessmentRegistryType assessmentRegistries(createdAt: DateTime, createdAtGte: DateTime, createdAtLte: DateTime, modifiedAt: DateTime, modifiedAtGte: DateTime, modifiedAtLte: DateTime, createdBy: [ID], modifiedBy: [ID!], project: [ID], lead: [ID], search: String, page: Int = 1, pageSize: Int): AssessmentRegistryListType assessmentRegOptions: AssessmentRegistryOptionsType @@ -3423,6 +3442,11 @@ type SectionType { widgets: [WidgetType!] } +type StakeholderCountType { + stakeholder: String + count: Int +} + type SummaryColumnType { colName: String colValue: Int