Skip to content

Commit

Permalink
big fix when numbers are not assigned
Browse files Browse the repository at this point in the history
  • Loading branch information
Jordan-Prescott committed May 17, 2024
1 parent 1fcfb6c commit 4cd6e39
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 15 deletions.
13 changes: 7 additions & 6 deletions odins_spear/reports/call_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,16 +82,17 @@ def main(api, service_provider_id: str, group_id: str, number: str, number_type:

try:
stranded_calls_settings = api.get.group_call_center_stranded_calls(call_center.service_user_id)
call_center.stranded_call_unavailable_action = stranded_calls_settings["action"]
call_center.stranded_call_unavailable_transfer_to_phone_number = stranded_calls_settings["transferPhoneNumber"] \
if call_center.stranded_call_unavailable_action == "Transfer" else None
call_center.stranded_calls_action = stranded_calls_settings["action"]
call_center.stranded_calls_transfer_to_phone_number = stranded_calls_settings["transferPhoneNumber"] \
if call_center.stranded_calls_action == "Transfer" else None
except Exception:
call_center.stranded_call_unavailable_action = None
call_center.stranded_call_unavailable_transfer_to_phone_number = None
call_center.stranded_calls_action = None
call_center.stranded_calls_transfer_to_phone_number = None

try:
stranded_calls_unavailable_settings = api.get.group_call_center_stranded_calls_unavailable(call_center.service_user_id)
call_center.stranded_call_unavailable_action = stranded_calls_unavailable_settings["action"]
action_value = stranded_calls_unavailable_settings["action"]
call_center.stranded_call_unavailable_action = None if action_value == 'None' else action_value
call_center.stranded_call_unavailable_transfer_to_phone_number = stranded_calls_unavailable_settings["transferPhoneNumber"] \
if call_center.stranded_call_unavailable_action == "Transfer" else None
except Exception:
Expand Down
21 changes: 12 additions & 9 deletions odins_spear/reports/report_utils/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,16 @@ def find_entity_with_number_type(number: str, number_type: str, broadwork_entiti
"""

for entity in broadwork_entities:
if number_type == 'dn' and number in entity.phone_number:
return entity
elif number_type == 'extension' and number in entity.extension:
return entity
elif number_type == 'alias':
for alias in entity.aliases:
if re.search(rf'\b{re.escape(alias)}\b', number):
return entity

try:
if number_type == 'dn' and number in entity.phone_number:
return entity
elif number_type == 'extension' and number in entity.extension:
return entity
elif number_type == 'alias':
for alias in entity.aliases:
if re.search(rf'\b{re.escape(alias)}\b', number):
return entity
except TypeError:
# issue when entity does not have a number, extenion, or alias assigned
continue
return None

0 comments on commit 4cd6e39

Please sign in to comment.