From caf6614b8f1e30b7bbb7e12ed06136f1fe684f1e Mon Sep 17 00:00:00 2001 From: mkrausse-ggtx <131683556+mkrausse-ggtx@users.noreply.github.com> Date: Thu, 14 Dec 2023 12:48:28 -0800 Subject: [PATCH] fixed bug in apply_canvass_result (#927) Co-authored-by: mattkrausse <106627640+mattkrausse@users.noreply.github.com> Co-authored-by: Matthew Krausse <69082853+matthewkrausse@users.noreply.github.com> Co-authored-by: Shauna --- parsons/ngpvan/people.py | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/parsons/ngpvan/people.py b/parsons/ngpvan/people.py index 11e59ef36c..34478570f9 100644 --- a/parsons/ngpvan/people.py +++ b/parsons/ngpvan/people.py @@ -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