From beb068701daa90350078961bc05d1404698a49bc Mon Sep 17 00:00:00 2001 From: pavlo-mk Date: Thu, 14 Nov 2024 11:27:50 +0100 Subject: [PATCH] add label_en --- src/hct_mis_api/apps/targeting/graphql_types.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/hct_mis_api/apps/targeting/graphql_types.py b/src/hct_mis_api/apps/targeting/graphql_types.py index 2efd9cbb59..6059f2916a 100644 --- a/src/hct_mis_api/apps/targeting/graphql_types.py +++ b/src/hct_mis_api/apps/targeting/graphql_types.py @@ -20,6 +20,7 @@ from hct_mis_api.apps.core.schema import ExtendedConnection, FieldAttributeNode from hct_mis_api.apps.core.utils import decode_id_string from hct_mis_api.apps.household.schema import HouseholdNode +from hct_mis_api.apps.payment.models import DeliveryMechanism from hct_mis_api.apps.program.models import Program from hct_mis_api.apps.targeting.choices import FlexFieldClassification from hct_mis_api.apps.targeting.filters import HouseholdFilter, TargetPopulationFilter @@ -118,10 +119,18 @@ class Meta: class TargetingCollectorBlockRuleFilterNode(DjangoObjectType): arguments = graphene.List(Arg) comparison_method = graphene.String() + label_en = graphene.String() def resolve_arguments(parent, info: Any) -> "GrapheneList": return parent.arguments + def resolve_label_en(parent, info: Any) -> Optional[str]: + # TODO: refactor that + for field in DeliveryMechanism.get_all_core_fields_definitions(): + if field["name"] == parent.field_name: + return field["label"]["English(EN)"] + return "" + class Meta: model = target_models.TargetingCollectorBlockRuleFilter