Commit Graph

2538 Commits

Author SHA1 Message Date
Martyn Inglis
f0e47029f2 "Created at" on the model 2017-05-11 15:23:18 +01:00
Martyn Inglis
8818bd5dba Scheduled task to call the timeout function 2017-05-11 15:22:57 +01:00
Martyn Inglis
b519321798 Adds a query to timeout the job counts.
After three days we timeout the notifications that we have not received a receipt for.

In the same way we bump the failed count to match the job count if there is a descepenecy. We do this after the same period that we do for notifications.
2017-05-11 15:22:43 +01:00
Martyn Inglis
e993a91a11 Added a created at column to the job stats table. 2017-05-11 15:21:27 +01:00
Martyn Inglis
76494a285e New logic to:
- increment sent only if the notifications is in a NON-finished state
- Increment outcome only if notification is in a finished state
2017-05-11 12:10:46 +01:00
Martyn Inglis
22a47106af Refactored the DAO to be clearer, and wrote tests for the bug whereby different types of inserts/updates caused others to reset. 2017-05-11 12:09:57 +01:00
Martyn Inglis
19c14982a2 Call the task wrapper outcome function in the statistics_tasks file. This wraps the logic around which tasks to creates and simplifies the logic in the Callback classes. 2017-05-09 22:03:57 +01:00
Martyn Inglis
a4549a2e26 Put the statistics tasks into a new queue. This currently has no worker in PaaS so blocks the deployment until new PaaS worker is configured. 2017-05-09 22:03:13 +01:00
Martyn Inglis
caed193647 Use the new task wrapper methods rather than creating a task directly 2017-05-09 18:17:55 +01:00
Martyn Inglis
f2a47044a4 Add a wrapper method around calling the tasks to manage when to call stats tasks 2017-05-09 18:17:26 +01:00
Martyn Inglis
70bc468da0 Ensure date set on creation 2017-05-09 18:16:44 +01:00
Martyn Inglis
b4bf332ea0 Added in tasks for created initial job stats and for updating following an outcome. 2017-05-09 15:24:05 +01:00
Martyn Inglis
2cbf8d29fd Removed white space for pep8 2017-05-09 14:46:15 +01:00
Martyn Inglis
4faafe01d9 Tightened the error checking.
- Looks now for a specific Integrity error, not a generic SQLAlchemy  error when checking for an insert failure
- If the update fails post an insert error, then there is an issue so raise an exception so tasks can be retried.
2017-05-09 14:41:29 +01:00
Martyn Inglis
15065c4bc7 Added DAO methods to add and update the stats table for JOBS
- create_or_update_job_sending_statistics
This will try and update an existing row. if this fails as it hasn't been created, then it will insert a row. If this fails as another process has got there first then it should try and update again.
This is a code version of upset

- update_job_stats_outcome_count
Will update the outcome states. Uses the NOTIFICATION_STATUS_TYPES_FAILED to determine if the notification failed.
Any thing in DELIVERED will be marked as delivered. Statues not in the FAILED array or delivered provoke no update to the table.
2017-05-09 14:06:27 +01:00
Martyn Inglis
a5caed5ac8 Changed job_stats table to have an update at time stamp 2017-05-09 14:04:19 +01:00
Martyn Inglis
9c3ea95dcd Changed job_stats table to have an update at time stamp 2017-05-09 14:04:07 +01:00
Martyn Inglis
b669c4930a Building the methods around async stats work 2017-05-09 12:30:31 +01:00
Martyn Inglis
9bedcbc1b3 removed the reference to internation numbers from migration script 2017-05-09 11:22:45 +01:00
Martyn Inglis
d647640b65 Added job statistics table 2017-05-09 11:22:05 +01:00
Rebecca Law
f5beb62c9f Merge pull request #940 from alphagov/search-by-number-or-email
Search for notification by number or email
2017-05-09 10:11:28 +01:00
Rebecca Law
a564b9aeb0 Update /service/{}/notifications to look for a "to" query string, if it exists call the search notifications_by_to_field method. 2017-05-08 17:20:21 +01:00
Rebecca Law
d252dc8976 New endpoint to search by "to" field of the notification.
The query ignores case and spaces.
2017-05-05 14:12:50 +01:00
Rebecca Law
42032f871f removed Flask-Redis dependency, it's included in notification-utils. 2017-05-04 14:57:57 +01:00
kentsanggds
61eb8cd625 Merge pull request #938 from alphagov/fix-rates
Update the valid_from date for the rate
2017-05-04 10:10:48 +01:00
Rebecca Law
81e10896ea Remove print statement 2017-05-04 09:47:27 +01:00
Rebecca Law
93e76d2362 Update the valid_from date for the rate that is intended to start at the begining of the financial year.
It was the start of the financial year in BST, needed to convert it to UTC.
Small change to the logic to find the rates.
2017-05-03 17:11:48 +01:00
minglis
64ef843777 Merge pull request #936 from alphagov/switch-on-rate-limit-in-prod
Switch on API rate limiting on production.
2017-05-03 16:11:23 +01:00
kentsanggds
195f8a305a Merge pull request #937 from alphagov/udpate_rates
Udpate rates
2017-05-03 13:52:50 +01:00
Ken Tsang
03885fea2f Update tests with new rates 2017-05-03 13:13:13 +01:00
Ken Tsang
d0df5c2180 Adjust rates in line to what admin expects 2017-05-03 13:02:36 +01:00
Martyn Inglis
97dcf766bc Switch on API rate limiting on production.
Limits POST API calls to send notifications on V1/V2 to 3000 in 60 seconds.
2017-05-03 12:13:32 +01:00
kentsanggds
31069ea5f5 Merge pull request #935 from alphagov/fix-usage_future_dates
Update billing data to handle future dates
2017-05-03 10:18:14 +01:00
Ken Tsang
a1a8397f74 Update billing data to handle future dates 2017-05-02 19:23:57 +01:00
Sakis
01e3a88d55 Merge pull request #920 from alphagov/autoconfirm_http_subscriptions
Autoconfirm http subscriptions
2017-05-02 17:03:41 +01:00
minglis
2dcebc0b52 Merge pull request #917 from alphagov/rate-limit-api-calls
Rate limit api calls
2017-05-02 15:07:54 +01:00
Rebecca Law
93a325eaae Merge pull request #934 from alphagov/fix-get_rates_for_year
Fix get rates for year
2017-05-02 11:40:50 +01:00
Rebecca Law
c40111a576 Split up a test 2017-05-02 11:20:01 +01:00
Martyn Inglis
b0baa1532a Added some logging around rate limiting. 2017-05-02 11:14:45 +01:00
Martyn Inglis
a9539d892c Merge branch 'master' into rate-limit-api-calls
Conflicts:
	requirements.txt
	tests/app/notifications/rest/test_send_notification.py
	tests/app/notifications/test_validators.py
	tests/app/v2/notifications/test_post_notifications.py
2017-05-02 10:56:56 +01:00
Rebecca Law
3e0221adec Change get_financial_year to return ending date as 1 microsecond earlier.
That way we can write the queries as between start and end dates, making it easier to read.
This makes more sense.
2017-05-02 10:00:47 +01:00
Rebecca Law
88d92d6070 Fix the logic gettting the rates for a financial year.
The is_between_end_date_exclusive is a bit funny.
Perhaps the better way to handle it is to make the function is_between but change the financial year function return an enddate that is one millisecond less. That way we can always use the between logic and it will be easier to use.
2017-04-28 16:55:41 +01:00
Athanasios Voutsadakis
c99b65252f Fix some typos 2017-04-28 16:11:27 +01:00
Athanasios Voutsadakis
cfed90e502 Make code a bit more defensive and add som logging 2017-04-28 16:10:41 +01:00
Athanasios Voutsadakis
336462cdb2 Fix whitespaces 2017-04-28 15:11:36 +01:00
Athanasios Voutsadakis
74433c9335 Add tests for autoconfirmation 2017-04-28 15:11:36 +01:00
Athanasios Voutsadakis
04b003c152 Add utility function for subscription autoconfirm 2017-04-28 15:11:36 +01:00
Imdad Ahad
3b350cdf30 Merge pull request #932 from alphagov/service-stats
treat sent as delivered in detailed service api
2017-04-28 14:15:30 +01:00
Imdad Ahad
34de722e73 Add test to check for sent notification 2017-04-28 13:32:23 +01:00
Leo Hemsted
f577e91134 treat sent as delivered in detailed service api
this is for when we fetch the large blue numbers for viewing
notifications for an entire service
2017-04-28 11:56:12 +01:00