There is no need to have a separate table to store template monthly statistics. It's easy enough to aggregate the stats from ft_notification_status.

This removes the nightly task, and all the dao methods.
The next PR will remove the table.
This commit is contained in:
Rebecca Law
2019-01-14 16:30:36 +00:00
parent 79f49ebdc2
commit efad58edd8
8 changed files with 1 additions and 915 deletions

View File

@@ -4,7 +4,6 @@ from datetime import datetime, date
import pytest
from freezegun import freeze_time
from app.celery.scheduled_tasks import daily_stats_template_usage_by_month
from app.models import (
EMAIL_TYPE,
SMS_TYPE,
@@ -55,22 +54,6 @@ def test_get_template_usage_by_month_returns_correct_data(
assert resp_json[1]["count"] == 1
@freeze_time('2017-11-11 02:00')
def test_get_template_usage_by_month_returns_no_data(admin_request, sample_template):
create_notification(sample_template, created_at=datetime(2016, 4, 1), status='created')
daily_stats_template_usage_by_month()
create_notification(sample_template, created_at=datetime.utcnow())
resp_json = admin_request.get(
'service.get_monthly_template_usage',
service_id=sample_template.service_id,
year=2015
)
assert resp_json['stats'] == []
@freeze_time('2017-11-11 02:00')
def test_get_template_usage_by_month_returns_two_templates(admin_request, sample_template, sample_service):
template_one = create_template(