Skip to content

Commit 0e22125

Browse files
committed
Set expected_visit_count to zero for excluded work areas
1 parent 8665c2c commit 0e22125

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

commcare_connect/microplanning/tests/test_views.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -780,6 +780,7 @@ def test_happy_path_excludes_not_started_areas(self, mock_hq, client, org_user_a
780780
assert wa.work_area_group is None
781781
assert wa.excluded_by == org_user_admin
782782
assert wa.excluded_reason == "Flooding"
783+
assert wa.expected_visit_count == 0
783784

784785
assert mock_hq.call_count == 2
785786

commcare_connect/microplanning/views.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,16 @@ def exclude_work_areas(request, org_slug, opp_id):
477477
work_area.excluded_by = request.user
478478
work_area.excluded_reason = exclusion_reason
479479
work_area.work_area_group = None
480-
work_area.save(update_fields=["status", "excluded_by", "excluded_reason", "work_area_group"])
480+
work_area.expected_visit_count = 0
481+
work_area.save(
482+
update_fields=[
483+
"status",
484+
"excluded_by",
485+
"excluded_reason",
486+
"work_area_group",
487+
"expected_visit_count",
488+
]
489+
)
481490

482491
if work_area.case_id and api_key and domain:
483492
create_or_update_case(api_key, domain, {"owner_id": ""}, case_id=str(work_area.case_id))

0 commit comments

Comments
 (0)