Commit Graph

7568 Commits

Author SHA1 Message Date
Pea Tyczynska
9ac65ee95c Start sending letters from insolvency service again 2020-10-21 16:56:18 +01:00
Pea M. Tyczynska
c149f5020f Merge pull request #3004 from alphagov/divide-letters-by-service
Divide letters by service when putting in ZIP files
2020-10-21 15:31:26 +01:00
Pea Tyczynska
d745ba310e Divide letters by service when putting in ZIPs
When letters are sent to DVLA, we will now put them in a separate
ZIP file for each service, so that if there are printing issues
due to bad files from one service, other services will hopefully
not be affected by that.
2020-10-21 15:19:06 +01:00
Pea M. Tyczynska
05160bc064 Merge pull request #2999 from alphagov/temporary-measure-letters
Temporarily do not send letters from Insolvency Service to DVLA
2020-10-16 16:24:34 +01:00
Pea Tyczynska
30bd311eb1 Temporarily do not send letters from Insolvency Service
to DVLA. This is a temporary measure over the weekend so that
DVLA can catch up with all other letters.

We should revert this on Monday 19.10.2020
2020-10-16 16:13:32 +01:00
Chris Hill-Scott
8b123fd6a4 Merge pull request #2996 from alphagov/serialise-broadcast-template-content
Serialise content for broadcast templates
2020-10-15 16:35:10 +01:00
Rebecca Law
9eb00bbb55 Merge pull request #2998 from alphagov/sort-zip-files
Adding service_id to the sort order for the letters being sent to print.
2020-10-15 13:19:08 +01:00
Rebecca Law
b2ff4277c9 Adding service_id to the sort order for the letters being sent to print.
We have had a few instances where letters have caused problems. Particularly for precompiled letters, often the issue comes from the same service.
The hope is that by adding a sort order this will help the print provider narrow down the problem.

There is a small degradation of the performance of the query, but it's not enough to concern me.
2020-10-15 09:39:07 +01:00
Chris Hill-Scott
3a2081dc06 Serialise content for broadcast templates
Broadcast services only have broadcast templates. But on the frontend
we show the template type under the name of the template. This is
redundant. It would be better to preview the content of the template
instead.

At the moment we can’t do this because we optimised the template schema
response to not include the content of the templates in
https://github.com/alphagov/notifications-api/pull/2880

This commit reverses that optimisation, for broadcast templates only,
and expands the tests to cover all template types.
2020-10-13 16:27:29 +01:00
Pea M. Tyczynska
50982ff36a Merge pull request #2991 from alphagov/reset-password-email-gets-forward-link
Put redirect link in reset password email link
2020-10-12 12:26:42 +01:00
Pea Tyczynska
51811de919 Improve variable names for readability
Also next_redirect parameter in _create_reset_password_url does
not have to be a default arg, so I removed that following review.
2020-10-09 17:47:26 +01:00
Chris Hill-Scott
e5413cd193 Merge pull request #2990 from alphagov/serialise-broadcast-content
Serialise content in broadcast message response
2020-10-08 11:56:51 +01:00
Chris Hill-Scott
57473ef65d Rename template_content to content
`template_content` is a template that hasn't had its placeholders filled
in whereas content is where it would have (which is what has happened
above)
2020-10-08 11:39:17 +01:00
Chris Hill-Scott
80352bafe1 Update test to check personalisation
While the API still has a column and field for personalisation I think
it makes sense for it to consider the personalisation when serialising
the broadcast, so we should have a test for this.

This way the API still works as a coherent whole, and the admin app just
happens to be a client of the API which doesn’t implement the
personalisation feature.

If we want to remove personalisation from the API at another time we
should do it wholesale.
2020-10-07 10:52:31 +01:00
Rebecca Law
690cf72175 Merge pull request #2989 from alphagov/change-config-for-scheduled-jobs
On the crazy weekend we checked for scheduled jobs every minute.
2020-10-06 13:15:21 +01:00
Pea Tyczynska
e91deff448 Put redirect link in reset password email link
This is so when users reset their password they are still
redirected to pages they were meant to visit.

This change was done specifically so everyone who is meant to see
broadcast tour sees it, but it will improve lives of all users
who wanted to visit a page on Notify but then had to reset
their password in the process
2020-10-05 16:58:10 +01:00
Chris Hill-Scott
7da0d46767 Serialise content in broadcast message response
This will let us show the content of the broadcast message in places we
can’t at the moment.
2020-10-02 16:39:24 +01:00
David McDonald
cfe32cf459 Merge pull request #2975 from alphagov/rename-redis-template-keys
Step 2 of renaming cache keys for templates
2020-10-02 14:26:03 +01:00
Chris Hill-Scott
f2314333b5 Merge pull request #2982 from alphagov/improve-efficiency-of-process-missing-rows
Improve efficiency of process missing rows task
2020-10-02 11:23:35 +01:00
Rebecca Law
cea46a0758 On the crazy weekend we checked for scheduled jobs every minute.
This changes that scheduled task to run at the top of the hour, 15, 30, and 45 minutes past
2020-10-01 14:14:08 +01:00
Chris Hill-Scott
298761070c Merge pull request #2987 from alphagov/bump-utils-42.2.1
Bump utils to 42.2.1
2020-09-29 14:33:01 +01:00
Chris Hill-Scott
29ff625a4b Bump utils to 42.2.1
Changes: https://github.com/alphagov/notifications-utils/compare/42.2.0...42.2.1
2020-09-29 12:34:44 +01:00
Chris Hill-Scott
19963b9b58 Merge pull request #2984 from alphagov/add-stats-endpoint-for-scheduled-jobs
Add an endpoint for stats about scheduled jobs
2020-09-29 10:24:09 +01:00
Leo Hemsted
59839d21b8 Merge pull request #2974 from alphagov/make-letter-folder-name-code-readable
Make letter folder name code readable
2020-09-28 13:58:08 +01:00
Chris Hill-Scott
4cee47da68 Add more tests for scheduled job stats
Ensures we don’t count jobs that are in a different status, or belong to
another service.
2020-09-28 13:15:39 +01:00
Rebecca Law
8974ec2550 Merge pull request #2985 from alphagov/reduce-logs
Reduce logs
2020-09-28 12:05:17 +01:00
Rebecca Law
e4e61b1e4b Merge pull request #2978 from alphagov/add-reference-to-msg
Add reference to log message
2020-09-28 12:04:59 +01:00
Rebecca Law
d1f641633d Reduce logs
The log message is not necessary, let's get rid.
2020-09-28 11:53:54 +01:00
Chris Hill-Scott
2fcde009ac Add an endpoint for stats about scheduled jobs
At the moment we display the count of scheduled jobs on the dashboard
by sending all the scheduled jobs to the admin app and letting it work
out the stats.

This is inefficient and, because the get jobs response has a page size
of 50, becomes incorrect if a service schedules more than 50 jobs.

This commit adds a separate endpoint which gives the admin app the stats
it needs directly and correctly.
2020-09-28 09:57:32 +01:00
Chris Hill-Scott
1c4775c5db Merge pull request #2983 from alphagov/run-scheduled_jobs
Make run-scheduled jobs to run every minute
2020-09-27 11:48:03 +01:00
Rebecca Law
e86c6b23c4 Make run-scheduled jobs to run every minute 2020-09-27 11:30:12 +01:00
Chris Hill-Scott
1d50bfaafc Remove unused column from query 2020-09-26 12:11:15 +01:00
Chris Hill-Scott
9ad33045dd Improve efficiency of process missing rows task
For every missing row this was:
- downloading the CSV file from S3
- looping through every row in it until it found the one matching the
  index of the missing row

`RecipientCSV` implements `__getitem__`[1] (which maybe it didn’t
before) so we can create it once, then index the relevant row directly.

***

1. 5ae0572d41/notifications_utils/recipients.py (L78-L79)
2020-09-26 12:06:48 +01:00
Chris Hill-Scott
f651176343 Merge pull request #2981 from alphagov/allow-20-mins-before-checking-missing-rows
Allow 20 minutes before checking for missing rows
2020-09-26 11:59:29 +01:00
Chris Hill-Scott
aace1bdd8a Allow 20 minutes before checking for missing rows
Since we’ve doubled the number of rows in a job, jobs can take twice as
long to insert all the notifications. We don’t check for missing rows
until we’re pretty confident that the original tasks have finished
processing. This means we need to double the time we wait to still be
as sure.
2020-09-26 11:38:38 +01:00
Chris Hill-Scott
2af62bdd1f Merge pull request #2980 from alphagov/bump-utils-42.2.0
Bump utils to 42.2.0
2020-09-25 18:24:13 +01:00
Chris Hill-Scott
379a227a1d Bump utils to 42.2.0
Increases CSV row limit from 50,000 to 100,000

Changes: https://github.com/alphagov/notifications-utils/compare/42.0.0...42.2.0
2020-09-25 18:16:14 +01:00
David McDonald
391a006376 Merge pull request #2979 from alphagov/sms-callback-app
add notify-api-sms-callbacks app
2020-09-25 10:40:52 +01:00
Leo Hemsted
9d5b629dad add notify-api-sms-callbacks app
we might need to deal with a potential large volume of SMS delivery
receipts. These receipts are POSTed to oru public api to two URLs. The
actual endpoint just parses the response body and puts a task on an SQS
queue - no database connections are required or anything like that.

Split up this traffic from other traffic, so that any increase in volume
of callbacks won't affect the scaling/load/etc of the main api apps.
We've hard coded instance counts to 10 on prod for now until we get an
idea of load.
2020-09-24 18:00:25 +01:00
Leo Hemsted
078a40f4da Merge pull request #2977 from alphagov/add-broadcast-org
add broadcast org
2020-09-24 14:21:08 +01:00
Rebecca Law
d7e53cdf50 Adding reference to message for "precompiled letters have been pending-virus-check for over 90 minutes"
This saves having to go to the db to get it.
2020-09-24 14:16:16 +01:00
Leo Hemsted
aac6b16b3c add broadcast org
keep the ID the same as the existing prod broadcast org to keep things
simple.

Move all services with a broadcast permission across to this new
service. Note that we'll need to clear the service and organisation
cache after deploying this
2020-09-23 17:05:17 +01:00
David McDonald
5b0cc8819a Use new redis key for templates
Equivalent of https://github.com/alphagov/notifications-admin/pull/3639
but for the API.

This is the only place in the API we appear to be getting setting
templates or broadcast messages.
2020-09-21 17:40:54 +01:00
Leo Hemsted
1e928a926a rename sending_date to created_at
we don't name letters based on the day we send them on, rather, the day
we create them on. If we process a letter for a second time for whatever
reason, even if it's a couple of days later, it'll still go in a folder
based on the created_at timestamp. There's still a slight confusion,
however - if the timestamp is after 5:30pm, the folder will be for the
day after. However, still the day after creation, so I think created_at
still makes the most sense.

Remove the term `sending_date` to try and make this relationship more
apparent.
2020-09-21 14:40:22 +01:00
Leo Hemsted
4f1e5ee5a3 remove ignore_folder from get_folder_name
it doesn't make sense to get the folder name if you know you aren't
going to use it.
2020-09-21 14:33:38 +01:00
Leo Hemsted
bb33927b3d rename letter get_folder_name args
`_now`? why would we ever use a different _now? instead say created_at,
because that's what it'll always be set to, even if we're replaying old
letters. We always set the folder name to when the letter was
created_at, or we might not know where to look to find it.

`dont_use_sending_date` doesn't really tell us what might happen if we
don't use it - the answer is we return an empty string. we ignore the
folder entirely. so lets call it that.

Also, remove use of freeze_gun in the tests, to prove that we don't use
the current time in any calculations. Also add an assert to a mock in
the get_pdf_for_templated_letter test, because we were mocking but not
asserting before, so the tests didn't fail when the function signature
changed.
2020-09-21 14:32:57 +01:00
David McDonald
120b760cae Merge pull request #2972 from alphagov/broadcast-invite-template
Broadcast invite template
2020-09-16 14:34:31 +01:00
David McDonald
f9911c7965 Send broadcast invite email for broadcast service invites
This means the copy is more accurate and mentions sending emergency
alerts rather than previous copy about sending emails texts and letters.
2020-09-15 16:47:41 +01:00
David McDonald
23ac7bcf56 Use sample broadcast service instead of sample service for tests
We only want to use a service that has permissions for broadcasts to
make our tests more realistic
2020-09-15 16:47:41 +01:00
David McDonald
6620590aad Add template for broadcast service invite 2020-09-15 16:47:41 +01:00