Skip to content

Commit

Permalink
Merge pull request #437 from dimagi/pkv/claim-limit-error
Browse files Browse the repository at this point in the history
Claim Limit Error
  • Loading branch information
sravfeyn authored Dec 5, 2024
2 parents 41b7557 + c403e34 commit 5a57bd0
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions commcare_connect/form_receiver/processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,10 +242,11 @@ def process_deliver_unit(user, xform: XForm, app: CommCareApp, opportunity: Oppo
entity=Count("pk", filter=Q(entity_id=deliver_unit_block.get("entity_id"), deliver_unit=deliver_unit)),
)
)
payment_unit = deliver_unit.payment_unit
claim = OpportunityClaim.objects.get(opportunity_access=access)
claim_limit = OpportunityClaimLimit.objects.get(opportunity_claim=claim, payment_unit=payment_unit)
entity_id = deliver_unit_block.get("entity_id")
entity_name = deliver_unit_block.get("entity_name")
payment_unit = deliver_unit.payment_unit
user_visit = UserVisit(
opportunity=opportunity,
user=user,
Expand All @@ -271,12 +272,9 @@ def process_deliver_unit(user, xform: XForm, app: CommCareApp, opportunity: Oppo
opportunity_access=access,
entity_id=entity_id,
payment_unit=payment_unit,
defaults={
"entity_name": entity_name,
},
defaults={"entity_name": entity_name},
)
user_visit.completed_work = completed_work
claim_limit = OpportunityClaimLimit.objects.get(opportunity_claim=claim, payment_unit=payment_unit)
if (
counts["daily"] >= payment_unit.max_daily
or counts["total"] >= claim_limit.max_visits
Expand Down

0 comments on commit 5a57bd0

Please sign in to comment.