Martyn Inglis
754ccbe9af
Removed update reference from updating the provider stats
...
- single focus method
- allows not to pollute DAO with research mode
2016-06-02 09:52:47 +01:00
Martyn Inglis
49f386e7c5
Refactored to put notifications update last
2016-06-02 09:17:06 +01:00
Nicholas Staples
276ca15919
Provider stats only updated if the provider successfully sends the message.
2016-06-01 12:43:26 +01:00
Martyn Inglis
2108bb52d5
Reorder updates to the notification / stats tables to match create.
2016-05-31 10:17:15 +01:00
Rebecca Law
2bfa9b7e10
Merge branch 'master' into permanent-failure-firetext
2016-05-27 12:10:59 +01:00
Rebecca Law
885abcaf16
Make update notification status transcational.
...
Refactor methods for reusability.
2016-05-27 12:09:36 +01:00
Leo Hemsted
a90a18541f
notifications/statistics returns when no stats exist for today
...
moved filtering from WHERE to JOIN ON so that when join suceeds but filter fails, we dont lose the service's data from the results set
2016-05-26 16:48:30 +01:00
Rebecca Law
25a1b7f31c
Firetext does not have a status code for temporary-failure.
...
In order to set a message as temporary-failure, we check if it is in pending status first.
Otherwise a delivery receipt for failure is set to permanent failure.
2016-05-26 16:46:00 +01:00
Rebecca Law
83df16025d
Merge pull request #347 from alphagov/get-jobs-created-in-last-7-days
...
Add a limit days query param for get all jobs.
2016-05-25 11:36:31 +01:00
Rebecca Law
a67793cf8a
Updated date query so that the created_at date is truncated so that we get all jobs created number of days requested.
2016-05-25 11:13:49 +01:00
Rebecca Law
e4eecb894a
Update job.notifications_delivered and job.notifications_failed count when updating the status of a notification.
2016-05-24 11:31:44 +01:00
Rebecca Law
cf2723bdc9
If the sms client provider sends more than one delivery receipt only take the update for the the first one.
...
Only update the notification.status if status = sending.
2016-05-20 17:04:56 +01:00
Leo Hemsted
81e5eb2c0a
return all zeros when NotificationStatistics dont exist
2016-05-20 15:24:57 +01:00
Leo Hemsted
0ad050043c
new /notification/statistics endpoint
2016-05-20 09:48:06 +01:00
Nicholas Staples
0fe0c1d2b4
Added job row number to the notification for csv jobs. All tests passing.
2016-05-19 10:46:03 +01:00
Rebecca Law
281a93b32d
Update ses callback to interpret hard and soft bounces.
...
If the notification has a status == sending then update the status otherwise do not update the status.
In other words do not change the status more than once.
2016-05-17 15:38:49 +01:00
Martyn Inglis
8669a169eb
Merge branch 'master' into primary-provider
...
Conflicts:
app/dao/notifications_dao.py
app/dao/provider_statistics_dao.py
app/schemas.py
tests/app/conftest.py
2016-05-10 09:13:02 +01:00
NIcholas Staples
f06aaa924e
Merge pull request #287 from alphagov/statistics_group_by_week_backup
...
Group by Notification Statistics added and all tests working.
2016-05-09 10:17:37 +01:00
Nicholas Staples
d40d9f76d4
Purge functional tests command added with passing test.
...
Code quality fix.
2016-05-06 11:16:30 +01:00
Martyn Inglis
57e05feafb
Updated the Provider stats and rates DAO objects to query based on the identifier in the ProviderDetails object.
...
- updated all tests
- changed teardown to leave provider details rows on end of individual tests
2016-05-06 09:09:47 +01:00
Nicholas Staples
f465066a69
Group by Notification Statistics added and all tests working.
...
Fixed tests for upgraded client.
2016-05-05 11:04:20 +01:00
Nicholas Staples
f71dbe9c0f
Message limit added and all tests passing.
2016-04-29 10:36:59 +01:00
Adam Shimali
4e81695c84
Added limit_days filter to get notifications dao.
2016-04-28 16:51:19 +01:00
Chris Hill-Scott
d7f6bb9976
Align date range for template + notification stats
...
We were using two different queries to filter template stats to the past
7 days, plus today.
Since we’re storing both as short dates, we can now use the same query
for both.
0 | 1 | 2 | 3 | 4 | 5 | 6 | 7
-------|---------|-----------|----------|--------|----------|--------|-------
Monday | Tuesday | Wednesday | Thursday | Friday | Saturday | Sunday | Monday
So if we are on Monday, the stats should include today, plus everything
back to last Monday.
Previously the template stats query was only going back to the Tuesday.
This should mean the numbers on the dashboard always line up.
2016-04-27 11:11:09 +01:00
Adam Shimali
886f302993
Removed unused code
2016-04-25 17:21:55 +01:00
Adam Shimali
24ea6f1637
Use short dates when selection notifications for deletion.
...
This means we will retain notifications for a full week and not
delete records that are 7 x 24 hours older than the time of the run of
the deletion task.
Also the task only needs to run once a day now, so I have changed
the celery config for the deletion tasks.
2016-04-25 16:12:46 +01:00
Nicholas Staples
3b1423a2ea
Provider Statistics added.
...
Rates command added with a test.
Updated to include added migration.
2016-04-21 13:47:04 +01:00
Adam Shimali
054d8baa0a
Changed notifications stats day column to date type from string.
2016-04-20 15:38:06 +01:00
Chris Hill-Scott
85d5c656f8
Merge pull request #241 from alphagov/get-notification-stats-last-7-days
...
Allow filtering of notification stats by days
2016-04-20 10:07:17 +01:00
Adam Shimali
a6a18c1a6f
This approach uses part of sqlalchemy example history_meta code
...
adapted to recording inserts and updates.
This removes need to manually create history tables.
Our code still remains in control of when history records are
created.
2016-04-19 17:13:26 +01:00
Chris Hill-Scott
9c2c9435e3
Allow filtering of notification stats by days
...
https://www.pivotaltracker.com/story/show/117920839
On the dashboard we want to show counts of notifications sent in the
last 7 days, plus today. So the API enpoint needs to accept an argument
to limit how many days worth of statistics it will return.
This is a bit fiddly at the DAO level because the date is just stored as
a string.
2016-04-19 16:44:19 +01:00
Nicholas Staples
31978bd987
Added page_size parameter for notifications api. All tests passing.
...
Add page_size and total parameters to all calls for notifications.
2016-04-19 11:26:21 +01:00
Nicholas Staples
f681d40366
Character count added and tests passing.
...
Remove sql restriction for count to not be null.
2016-04-15 16:31:13 +01:00
Nicholas Staples
90f0505a3d
Update limit to message_limit.
...
Further db changes and updates.
Remove traceback print out.
Fix bug in passing template id to a task.
2016-04-11 16:53:40 +01:00
Adam Shimali
4ed2e7f8f2
Fix for misunderstanding about date range required for templates
...
stats.
It should always be last n days, whether or not there is data.
2016-04-07 09:30:02 +01:00
Adam Shimali
3057641e40
Change sort order for templates from name to date using full timestamp
...
so that it would be most recently used at top.
2016-04-06 14:30:13 +01:00
Nicholas Staples
4d15409781
Successful notifications are deleted after a week now. All tests passing.
2016-04-05 11:07:21 +01:00
Adam Shimali
f6620792b5
Additional sort order by template name for template statistics.
2016-04-04 17:51:24 +01:00
Adam Shimali
0d06be05e1
[WIP] Added dao method and rest endpoint for getting template
...
statistics by service.
Some cosmetic changes to imports.
Added fix for job rest not correctly returning errors.
2016-04-04 14:38:54 +01:00
Nicholas Staples
fac34aff10
Added functionality to allow filtering by multiple arguments.
...
Removed commented out code.
2016-04-04 13:21:51 +01:00
Adam Shimali
ca9c886c3e
[WIP] On create of notification. Upsert record for template stats
...
recording usages of template by day.
2016-03-31 15:57:50 +01:00
Martyn Inglis
268819284f
Merge branch 'master' into capture-delivery-outcomes
...
Conflicts:
tests/app/notifications/test_rest.py
2016-03-21 13:32:31 +00:00
Martyn Inglis
e0316d1881
Adds notification stats update into the callback process
...
- when a provider callback occurs and we update the status of the notification, also update the statistics table
Adds:
- Mapping object to the clients to handle mapping to various states from the response codes, this replaces the map.
- query lookup in the DAO to get the query based on response type / template type
Tests around rest class and dao to check correct updating of stats
Missing:
- multiple client callbacks will keep incrementing the counts of success/failure. This edge case needs to be handle in a future story.
2016-03-21 13:24:37 +00:00
Nicholas Staples
327f169575
Filtering added and tests working.
2016-03-21 12:37:34 +00:00
Martyn Inglis
69654f4209
Parking some code that updates stats when notification delivery happens
2016-03-15 14:40:42 +00:00
Martyn Inglis
1ff4ebad5c
Merge branch 'master' into client-callbacks
...
Conflicts:
app/notifications/rest.py
tests/app/celery/test_tasks.py
2016-03-14 11:45:21 +00:00
Martyn Inglis
fd973179cc
- Commit session on job update
...
- log at exception level
2016-03-14 11:34:09 +00:00
Martyn Inglis
62a7b8bcd0
Update notification status by message reference
...
- SES sends a reference to allow us to identify the notification
- use this to update status
If source of email is one of our internal emails (invites or validations) - don't try and update a notification.
2016-03-11 10:19:40 +00:00
Martyn Inglis
901d04605f
Ad a reference to the model
...
- used if 3rd party needs to record an ID for reconciliation purposes
2016-03-11 09:40:35 +00:00
Martyn Inglis
f88f86a924
Endpoint to allow SES updates to occur
...
- update notification with delivery state
2016-03-10 17:29:17 +00:00