Skip to content

Commit

Permalink
Add check for deliver units with no payment units
Browse files Browse the repository at this point in the history
  • Loading branch information
pxwxnvermx committed Jan 30, 2025
1 parent 621a23c commit f7d995d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion commcare_connect/opportunity/visit_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,9 @@ def _bulk_update_visit_status(opportunity: Opportunity, dataset: Dataset):
seen_visits = set()
user_ids = set()
deliver_units = opportunity.deliver_app.deliver_units.all().select_related("payment_unit")
deliver_unit_limits = {d.id: (d.payment_unit.max_daily, d.payment_unit.max_total) for d in deliver_units}
deliver_unit_limits = {
d.id: (d.payment_unit.max_daily, d.payment_unit.max_total) for d in deliver_units if d.payment_unit is not None
}
counts = (
UserVisit.objects.filter(opportunity=opportunity, status=VisitValidationStatus.approved)
.values_list("user_id", "deliver_unit_id", "visit_date")
Expand Down

0 comments on commit f7d995d

Please sign in to comment.