mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-01 07:35:34 -05:00
Refactor to switch properly when providers have equal priority with test
This commit is contained in:
@@ -21,14 +21,12 @@ def update_provider_priorities(current_provider, new_provider):
|
||||
# Swap priority to change primary provider
|
||||
if new_provider.priority > current_provider.priority:
|
||||
new_provider.priority, current_provider.priority = current_provider.priority, new_provider.priority
|
||||
_print_provider_switch_logs(current_provider, new_provider)
|
||||
return [current_provider, new_provider]
|
||||
|
||||
# Incease other provider priority if equal
|
||||
elif new_provider.priority == current_provider.priority:
|
||||
current_provider.priority += 10
|
||||
_print_provider_switch_logs(current_provider, new_provider)
|
||||
return [current_provider]
|
||||
|
||||
_print_provider_switch_logs(current_provider, new_provider)
|
||||
|
||||
|
||||
def _print_provider_switch_logs(current_provider, new_provider):
|
||||
|
||||
Reference in New Issue
Block a user