Skip to content

Commit

Permalink
OM-243: added additional filters for workers
Browse files Browse the repository at this point in the history
  • Loading branch information
sniedzielski committed Aug 20, 2024
1 parent 93d569f commit 121a869
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions worker_voucher/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,12 @@ def resolve_worker(self, info, client_mutation_id=None, policy_holder_code=None,
filters.append(Q(mutations__mutation__client_mutation_id=client_mutation_id))

if policy_holder_code:
filters.append(
Q(policyholderinsuree__policy_holder__code=policy_holder_code)
)
workers_filters = [
Q(policyholderinsuree__policy_holder__code=policy_holder_code),
Q(policyholderinsuree__policy_holder__is_deleted=False),
Q(policyholderinsuree__is_deleted=False),
]
filters += workers_filters

return gql_optimizer.query(Insuree.objects.filter(*filters).distinct(), info)

Expand All @@ -106,7 +109,9 @@ def resolve_previous_workers(self, info, economic_unit_code=None, date_range=Non
workervoucher__is_deleted=False,
workervoucher__policyholder__is_deleted=False,
workervoucher__policyholder__code=economic_unit_code,
policyholderinsuree__policy_holder__code=economic_unit_code
policyholderinsuree__policy_holder__code=economic_unit_code,
policyholderinsuree__is_deleted=False,
policyholderinsuree__policy_holder__is_deleted=False,
)

if date_range:
Expand Down

0 comments on commit 121a869

Please sign in to comment.