Removed update reference from updating the provider stats

- single focus method
- allows not to pollute DAO with research mode
This commit is contained in:
Martyn Inglis
2016-06-02 09:52:47 +01:00
parent 099c17192d
commit 754ccbe9af
5 changed files with 31 additions and 29 deletions

View File

@@ -278,9 +278,13 @@ def dao_update_notification(notification):
@transactional
def update_notification_after_sent_to_provider(id_, notification_type, provider_name, reference=None):
provider = ProviderDetails.query.filter_by(identifier=provider_name).one()
def update_provider_stats(
id_,
notification_type,
provider_name):
notification = Notification.query.filter(Notification.id == id_).one()
provider = ProviderDetails.query.filter_by(identifier=provider_name).one()
def unit_count():
if notification_type == TEMPLATE_TYPE_EMAIL:
@@ -304,10 +308,6 @@ def update_notification_after_sent_to_provider(id_, notification_type, provider_
db.session.add(provider_stats)
if reference:
notification.reference = reference
db.session.add(notification)
def get_notification_for_job(service_id, job_id, notification_id):
return Notification.query.filter_by(service_id=service_id, job_id=job_id, id=notification_id).one()