Only show active providers when changing priority

This fixes a bug where a third inactive provider would (potentially)
appear in place of one of the two active ones, depending on the order
of its identifier compared to the other two.

In future we may look at simplifying this to cope with more than two
active providers. For now, the existing UI will continue to work when
we add a new, inactive SMS provider for Reach.
This commit is contained in:
Ben Thorner
2022-03-25 16:30:54 +00:00
parent f9749c0ae3
commit 9355c4f8d1
2 changed files with 17 additions and 15 deletions

View File

@@ -65,6 +65,7 @@ def edit_sms_provider_ratio():
provider
for provider in provider_client.get_all_providers()['provider_details']
if provider['notification_type'] == 'sms'
and provider['active']
], key=itemgetter('identifier'), reverse=True)
form = AdminProviderRatioForm(ratio=providers[0]['priority'])