Skip to content

Commit

Permalink
add label_en
Browse files Browse the repository at this point in the history
  • Loading branch information
pavlo-mk committed Nov 14, 2024
1 parent bbdab5c commit beb0687
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/hct_mis_api/apps/targeting/graphql_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit beb0687

Please sign in to comment.