Commit Graph

3661 Commits

Author SHA1 Message Date
Richard Chapman
a44bf367d9 Merge branch 'master' of https://github.com/alphagov/notifications-api 2017-10-17 12:43:08 +01:00
Richard Chapman
5de0f46979 Merge pull request #1313 from alphagov/rc_process_missing_rows_in_csv
Process Incomplete Jobs, if a job have been discovered to be incomplete.
2017-10-17 12:35:34 +01:00
Leo Hemsted
6534be47dc Merge pull request #1318 from alphagov/email-validation
ensure emails are formatted before sending
2017-10-17 11:46:23 +01:00
Richard Chapman
df80d2e059 Merge branch 'master' of https://github.com/alphagov/notifications-api 2017-10-17 11:37:54 +01:00
Richard Chapman
543535e2af Process Incomplete Jobs Updates
Comments are PR review. Updated code style in a few places to make it
more consistent with other code, added tests for letters and emails
so they are testedt, refactored some database queries to dao file

- Fixed code style
- Refactored database queries to dao code
- Added tests for emails and sms.
2017-10-17 11:07:36 +01:00
Leo Hemsted
5ad6bc7621 ensure emails are formatted before sending
we allow some invalid to addresses - for example, phone numbers with
spaces or brackets - in the database. This is so that users can match
up their data in a format that they expect (since they passed it in).
When we send SMS, we strip this formatting just before sending - but we
weren't with email. This commit changes that and adds some tests.

It also adds formatting for reply_to addresses. We should never expect
invalid reply_to email addresses in our data, but just in case, lets
validate them here.

Also, bump requirements.txt to capture some more email validation
2017-10-16 17:29:45 +01:00
Venus Bailey
45ecab00e3 Merge pull request #1317 from alphagov/revert-1314-revert-1305-vk-free-sms-limit
Revert "Revert "[#151837054] Add new column free_sms_fragment_limit in the Services table""
2017-10-16 16:37:19 +01:00
Venus Bailey
9b60d69931 Revert "Revert "[#151837054] Add new column free_sms_fragment_limit in the Services table"" 2017-10-16 16:24:34 +01:00
Sakis
e9b76d7d75 Merge pull request #1311 from alphagov/remove-unnecessary-routes
Drop api-paas.* route
2017-10-16 16:19:56 +01:00
Leo Hemsted
75610682c3 Merge pull request #1316 from alphagov/callback-fix
reset notification to created if fake callback throws exception
2017-10-16 15:50:02 +01:00
Leo Hemsted
19bb0d157d reset notification to created if fake callback throws exception
else we ignore it when retrying
2017-10-16 15:49:13 +01:00
Leo Hemsted
fd5aa7dd0a Merge pull request #1315 from alphagov/callback-ip-whitelist
Remove ip whitelist from callbacks
2017-10-16 13:55:06 +01:00
Leo Hemsted
d33c25bdac update research mode notifications after callback has been made
if the callback fails, they should still tech fail
2017-10-16 13:30:16 +01:00
Leo Hemsted
63d9fb46e7 remove ip restrictions from sms delivery receipts for now
our research mode tasks were hitting these endpoints, and getting 403s,
causing lots of unexpected exceptions.
2017-10-16 13:30:13 +01:00
Venus Bailey
87b819dd53 Merge pull request #1314 from alphagov/revert-1305-vk-free-sms-limit
Revert "[#151837054] Add new column free_sms_fragment_limit in the Services table" because of a temporary failure on PaaS
2017-10-16 13:03:54 +01:00
Venus Bailey
616a6f8ef8 Revert "[#151837054] Add new column free_sms_fragment_limit in the Services table" 2017-10-16 12:43:05 +01:00
Richard Chapman
0ff80bcb76 Process Incomplete Jobs Refactor
- Moved the process_incomplete_jobs to tasks.py
- Moved the process_incomplete_jobs test to test_tasks.py
- Cleaned up imports and other code style issues.

As the new tasks is not a scheduled one, moved the the tasks.py file.
This makes it more consisted with other tasks. Updated a few code style
issues to make it more consistent with other coe and hence more
maintainable in future.
2017-10-16 12:33:39 +01:00
Richard Chapman
9e6deddbd4 Merge branch 'master' of https://github.com/alphagov/notifications-api 2017-10-16 12:33:03 +01:00
Venus Bailey
e32350967e Merge pull request #1305 from alphagov/vk-free-sms-limit
[#151837054] Add new column free_sms_fragment_limit in the Services table
2017-10-16 11:51:35 +01:00
Richard Chapman
22b933b8f1 Merge branch 'master' of https://github.com/alphagov/notifications-api 2017-10-13 16:47:05 +01:00
Richard Chapman
0509669969 Process Incomplete Jobs
- Added a new task to process incomplete jobs
- Added tests to test the new method
- Updated the check for incomplete jobs method to start the new task

This will effectively resume tasks which for some reason were interrupted
whilst they were being processed. In some cases only some of the csv
was processed, this will find the place in the csv and continue processing
from that point.
2017-10-13 16:46:17 +01:00
kentsanggds
c110ca3f57 Merge pull request #1303 from alphagov/ken-purge-noti-to-email_reply_to
Purge notifications to email reply to rows older than 7 days
2017-10-13 15:23:58 +01:00
Richard Chapman
83585a4fdb Merge pull request #1304 from alphagov/ken-alert-missing-notis
Added alert when job.notification_count doesn't match total notification for job
2017-10-13 11:12:23 +01:00
Richard Chapman
b32b9bc344 Merge pull request #1308 from alphagov/pyup-update-flask-sqlalchemy-2.2-to-2.3.2
Update flask-sqlalchemy to 2.3.2
2017-10-13 09:27:33 +01:00
Richard Chapman
a3c8b5bbed Merge pull request #1310 from alphagov/rc_adding_logging_to_celery_tasks
Adding extra logging to celery tasks and gunicorn
2017-10-13 09:15:27 +01:00
Venus Bailey
2d5c87a185 Merge pull request #1300 from alphagov/pyup-update-sqlalchemy-utils-0.32.16-to-0.32.18
Update sqlalchemy-utils to 0.32.18
2017-10-12 17:32:22 +01:00
Rebecca Law
401e209856 Removed the new queue name as it is not needed. 2017-10-12 16:57:04 +01:00
Rebecca Law
fd2a7d3341 fix comment 2017-10-12 16:23:28 +01:00
Rebecca Law
e08690cad2 Added a new scheduled task that runs every minute, may want to run it every 3 minutes.
The tasks checks that a job is not still in progress 30 minutes after the job started processing.
2017-10-12 16:21:08 +01:00
Athanasios Voutsadakis
0b3136397b Drop api-paas.* route
This was introduced during the migration and is no longer needed nor
should it be used.
2017-10-12 14:51:04 +01:00
Katie Smith
9322ed0ca3 Add command to populate the free_sms_fragment_limit
Added a one-off command to set values of the free_sms_fragment_limit in
the services table and the services_history table to the default of
250000.
2017-10-12 13:54:43 +01:00
Katie Smith
2001bfca36 Set free_sms_fragment_limit when creating a service
The free_sms_fragment_limit of a service is set when the service is
created. If a value for the free_sms_fragment_limit is not given, the
default value is used.
2017-10-12 13:54:43 +01:00
Richard Chapman
83a8277b16 Fixed Typo in Log Message
After review, fixed a typo in the log message to make it consistent
 with other messages so it can be search for in logs and used in alerts.
2017-10-12 12:31:51 +01:00
venusbb
f95282a84d Add column, free_sms_fragment_limit, to services & services_history
- Created new column in both tables
- Modified model and Service schema
- Modifed existing test
2017-10-12 12:16:13 +01:00
Rebecca Law
c068c922b4 Merge branch 'master' into ken-alert-missing-notis 2017-10-12 11:48:54 +01:00
Richard Chapman
cc4d022213 Adding extra logging to celery tasks ans gunicorn, specifically log on SIGTERM and SIGINIT so that we can track better when an app restarts and why it restarts e.g. when it restarts after another signal. 2017-10-12 11:39:21 +01:00
Rebecca Law
fe37313d18 Merge pull request #1309 from alphagov/save-email-reply-to-for-one-off
Add email_reply_to_id for one off notifications
2017-10-12 10:53:38 +01:00
Rebecca Law
e23638ed78 Added a test for when the reply to email id does not exist 2017-10-12 09:34:37 +01:00
Ken Tsang
f9a7a78e55 Refactor code
- removed redundant dao method
- also handle letter jobs
2017-10-11 21:48:47 +01:00
Ken Tsang
c29fc8cfa4 Add celery task to check job finished
- celery task called after countdown of 60 minutes from start of job processing
2017-10-11 18:14:56 +01:00
Rebecca Law
769a7a275b Insert a row for the mapping of notification to email_reply_to for one off notifications. 2017-10-11 16:23:31 +01:00
pyup-bot
6050526711 Update flask-sqlalchemy from 2.2 to 2.3.2 2017-10-11 16:19:09 +01:00
Ken Tsang
92508d3b96 Create JobIncompleteError 2017-10-11 15:50:20 +01:00
Ken Tsang
1eaf6e089b Refactor code to make it clearer
- Added code in `delete_notifications_created_more_than_a_week_ago_by_type` to remove notifications to email_reply_to older than 7 days
- Added transactional to `delete_notifications_created_more_than_a_week_ago_by_type`
2017-10-11 12:26:58 +01:00
Ken Tsang
dcf0d22d7b Added alert when job.notification_count doesn't match total notification for job
- Added log for when a job starts so that we will know when the processing of a job starts with the number of notifications
- Added dao method to get total notifications for a job id
- Added a test to check whether the number of notifications in the table matches the job notification_count
2017-10-10 15:04:55 +01:00
Ken Tsang
b77a606699 Reorder imports 2017-10-09 15:12:50 +01:00
Ken Tsang
b7bc04f47b Removed redundant import 2017-10-09 15:02:15 +01:00
Richard Chapman
04914d711a Merge pull request #1301 from alphagov/rc_populate_reply_to_address
Task 4 - Allow API calls to specify the reply address option
2017-10-09 14:55:52 +01:00
Ken Tsang
2c46f201b5 Purge noti to email reply to older than 7 days 2017-10-09 14:51:27 +01:00
Richard Chapman
8c5771401a A few code style tweaks to adhere to standard for better maintainable code. 2017-10-06 17:08:06 +01:00