Skip to content

Commit

Permalink
fixed bug in apply_canvass_result (move-coop#927)
Browse files Browse the repository at this point in the history
Co-authored-by: mattkrausse <[email protected]>
Co-authored-by: Matthew Krausse <[email protected]>
Co-authored-by: Shauna <[email protected]>
  • Loading branch information
4 people authored Dec 14, 2023
1 parent 2f2f5ce commit caf6614
Showing 1 changed file with 20 additions and 7 deletions.
27 changes: 20 additions & 7 deletions parsons/ngpvan/people.py
Original file line number Diff line number Diff line change
Expand Up @@ -646,17 +646,30 @@ def apply_response(
"resultCodeId": result_code_id,
}

if contact_type_id == 1 or contact_type_id == 37:
if phone:
json["canvassContext"]["phone"] = {
"dialingPrefix": "1",
"phoneNumber": phone,
}
else:
if (
contact_type_id == 1 # Phone
or contact_type_id == 19 # Auto Dial
or contact_type_id == 37 # SMS Text
or contact_type_id == 67 # Phone Bank
or contact_type_id == 68 # Consumer Phone
or contact_type_id == 72 # Leader Phone
or contact_type_id == 112 # Personal Phone
or contact_type_id == 132 # Relational Text
or contact_type_id == 143 # Distributed Text
or contact_type_id == 147 # Bulk Text
or contact_type_id == 149 # Paid SMS
):
if not phone:
raise Exception(
"A phone number must be provided if canvassed via phone or SMS"
)

if phone:
json["canvassContext"]["phone"] = {
"dialingPrefix": "1",
"phoneNumber": phone,
}

if response:
json["responses"] = response

Expand Down

0 comments on commit caf6614

Please sign in to comment.