remove unused provider dao functions

This commit is contained in:
Leo Hemsted
2019-11-11 14:47:20 +00:00
parent fa7e0a1e84
commit 8fa7cde593
3 changed files with 19 additions and 102 deletions

View File

@@ -66,29 +66,6 @@ def dao_toggle_sms_provider(*args, **kwargs):
raise NotImplementedError
@transactional
def dao_switch_sms_provider_to_provider_with_identifier(identifier):
new_provider = get_provider_details_by_identifier(identifier)
if provider_is_inactive(new_provider):
return
# Check first to see if there is another provider with the same priority
# as this needs to be updated differently
conflicting_provider = dao_get_sms_provider_with_equal_priority(new_provider.identifier, new_provider.priority)
providers_to_update = []
if conflicting_provider:
switch_providers(conflicting_provider, new_provider)
else:
current_provider = get_current_provider('sms')
if not provider_is_primary(current_provider, new_provider, identifier):
providers_to_update = switch_providers(current_provider, new_provider)
for provider in providers_to_update:
dao_update_provider_details(provider)
def get_provider_details_by_notification_type(notification_type, supports_international=False):
filters = [ProviderDetails.notification_type == notification_type]
@@ -108,19 +85,6 @@ def dao_update_provider_details(provider_details):
db.session.add(history)
def dao_get_sms_provider_with_equal_priority(identifier, priority):
provider = db.session.query(ProviderDetails).filter(
ProviderDetails.identifier != identifier,
ProviderDetails.notification_type == 'sms',
ProviderDetails.priority == priority,
ProviderDetails.active
).order_by(
asc(ProviderDetails.priority)
).first()
return provider
def dao_get_provider_stats():
# this query does not include the current day since the task to populate ft_billing runs overnight