Break down usage by month, filter by year

The previous, weekly activity breakdown was what we reckoned might be
useful. But now that we have people using the platform it feels like
aggregating a service’s usage by month is:
- matches the timeframe users report on within their organisation
- is consistent with the usage page

And like the usage page this commit also limits the page to only show
one financial year’s worth of data at once (rather than data for all
time).

This commit also makes some changes to the jobs view code so that our
aggregation of failure states is consistent between the dashboard pages
and the jobs pages.
This commit is contained in:
Chris Hill-Scott
2017-01-30 17:27:09 +00:00
parent c35e1ee6af
commit ac9d4f2daf
11 changed files with 210 additions and 124 deletions

View File

@@ -33,6 +33,9 @@ from app.utils import (
generate_notifications_csv,
get_help_argument,
get_template,
REQUESTED_STATUSES,
FAILURE_STATUSES,
SENDING_STATUSES,
)
from app.statistics_utils import add_rate_to_job
@@ -53,12 +56,10 @@ def _parse_filter_args(filter_dict):
def _set_status_filters(filter_args):
status_filters = filter_args.get('status', [])
all_failure_statuses = ['failed', 'temporary-failure', 'permanent-failure', 'technical-failure']
all_sending_statuses = ['created', 'sending']
return list(OrderedSet(chain(
(status_filters or all_sending_statuses + ['delivered'] + all_failure_statuses),
all_sending_statuses if 'sending' in status_filters else [],
all_failure_statuses if 'failed' in status_filters else []
(status_filters or REQUESTED_STATUSES),
SENDING_STATUSES if 'sending' in status_filters else [],
FAILURE_STATUSES if 'failed' in status_filters else []
)))