mirror of
https://github.com/GSA/notifications-api.git
synced 2026-01-31 23:26:23 -05:00
Removed updates to templates statistics
- on create notification we updated the templates stats to record the usage. - this is now based on notification history - this update and associated tests are now removed,
This commit is contained in:
@@ -16,7 +16,6 @@ from app.models import (
|
||||
Service,
|
||||
Notification,
|
||||
NotificationHistory,
|
||||
Job,
|
||||
NotificationStatistics,
|
||||
TemplateStatistics,
|
||||
SMS_TYPE,
|
||||
@@ -139,17 +138,6 @@ def dao_create_notification(notification, notification_type):
|
||||
)
|
||||
db.session.add(stats)
|
||||
|
||||
update_count = db.session.query(TemplateStatistics).filter_by(
|
||||
day=date.today(),
|
||||
service_id=notification.service_id,
|
||||
template_id=notification.template_id
|
||||
).update({'usage_count': TemplateStatistics.usage_count + 1, 'updated_at': datetime.utcnow()})
|
||||
|
||||
if update_count == 0:
|
||||
template_stats = TemplateStatistics(template_id=notification.template_id,
|
||||
service_id=notification.service_id)
|
||||
db.session.add(template_stats)
|
||||
|
||||
if not notification.id:
|
||||
# need to populate defaulted fields before we create the notification history object
|
||||
notification.id = uuid.uuid4()
|
||||
|
||||
Reference in New Issue
Block a user