Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

big fix when numbers are not assigned #31

Merged
merged 1 commit into from
May 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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