Commit Graph

141 Commits

Author SHA1 Message Date
Rebecca Law
da8a7a8db1 Avoid key errors by setting the year_start with 2020 or 2021
Remove db.create_service_with_organisation method
Update comment in command
2021-03-30 09:08:04 +01:00
Rebecca Law
7da5abc17b The free sms allowances are changing for the financial year starting
April 1 2021.

In this PR there is a command to set annual_billing for all active
services with the the new defaults.

The new method `set_default_free_allowance_for_service` will also be
called in a PR to follow that will set a services free allowance to the
default if the organisation for the service is changed.
2021-03-29 13:32:00 +01:00
Katie Smith
27b3cece7d Send template id and version with delivery status callback
This adds the `template_id` and `template_version` fields to the data
sent to services from the `send_delivery_status_to_service` task.

We need to account for the task not being passed these fields at first
since there might be tasks retrying which don't have that data. Once all
tasks have been called with the new fields we can then update the code
to assume they are always there.

Since we only send delivery status callbacks for SMS and emails, I've
removed the tests where we call that task with letters.
2021-03-24 10:55:45 +00:00
David McDonald
41d95378ea Remove everything for the performance platform
We no longer will send them any stats so therefore don't need the code
- the code to work out the nightly stats
- the performance platform client
- any configuration for the client
- any nightly tasks that kick off the sending off the stats

We will require a change in cronitor as we no longer will have this task
run meaning we need to delete the cronitor check.
2021-03-15 12:04:53 +00:00
Leo Hemsted
d94d0bc8d7 rename invite blueprints
nb: the routes are not changing as part of this, only file paths and
blueprint names.

invite -> service_invite

this blueprint handles fetching invites for a service, creating invites,
etc.

accept_invite -> global_invite

this blueprint handles accepting invites for now, but will also involve
retrieving service/org user invite data without knowing the service/org
id associated. i'm not in love with this name and open to suggestions,
but i wanted to contrast it from service_invite and
organisation/invite_rest.py.
2021-03-12 13:55:43 +00:00
Ben Thorner
a91fde2fda Run auto-correct on app/ and tests/ 2021-03-12 11:45:45 +00:00
Rebecca Law
3099c51e12 Command to load the processing time data for the new ft_processing_time
data.
2021-02-26 07:49:49 +00:00
Rebecca Law
21edf7bfdd Persist the processing time statistics to the database.
The performance platform is going away soon. The only stat that we do not have in our database is the processing time. Let me clarify the only statistic we don't have in our database that we can query efficiently is the processing time. Any queries on notification_history are too inefficient to use on a web page.
Processing time = the total number of normal/team emails and text messages plus the number of messages that have gone from created to sending within 10 seconds per whole day. We can then easily calculate the percentage of messages that were marked as sending under 10 seconds.
2021-02-26 07:49:49 +00:00
Pea Tyczynska
95deb5a52f Move DATETIME_FORMAT from app to app.utils
To avoid cyclical import issues
2020-12-18 17:39:35 +00:00
Pea Tyczynska
d506451d4f Include template id, too 2020-06-24 12:20:40 +01:00
Pea Tyczynska
4b2a0037e3 Get letter data for provided filenames 2020-06-23 17:45:05 +01:00
David McDonald
2f0b3a9636 Fix edge case in func test data purging for created_by_id
When running the purge command I found about 4 users who could not be
deleted because their user id was still referenced in the services table
as they had created the service yet they were not a member of that
service anymore.

I have fixed this by checking that if they are not a member but created
the service then we also delete the service for them.

Note, I've followed the previous convention of no tests for this
function. I've run it locally and executed the code path so there should
be no major flaws in the code. There is a small chance I wasn't able to
exactly replicate the state that existed in preview on my local but
hopefully it was close enough to be accurate.
2020-05-18 10:30:28 +01:00
David McDonald
df5ccae4c5 Add in positive logging case for purge command
This is useful so we can see that it's doing things, which case is being
hit and know that an empty terminal for an hour isn't a bad thing
2020-05-15 17:34:30 +01:00
Pea Tyczynska
5d6f2da155 Rename task from create_letters_pdf to get_pdf_for_templated_letter
In a separate PR we will have to delete vestigial create_letters_pdf
tasks that now only redirects to get_pdf_for_templated_letter.
2020-05-11 13:33:05 +01:00
Chris Hill-Scott
8c8c8b6328 Look in all parts of a letter template to find placeholders
Text messages have placeholders in their body.

Emails have them in their subject line too.

Letters have them in their body, subject line and contact block.

We were only looking in the the body and subject when processing a job,
therefore the thing assembling the letter was not looking in all the
CSV columns it needed to, because it hadn’t been told about any
placeholders in the contact block.

Fixing this means always making sure we use the correct `Template`
instance for the type of template we’re dealing with. Which we were
already doing in a different part of the codebase. So it makes sense to
reuse that.

Turns out we fixed the same bug for email subjects over 3 years ago:
3ed97151ee
2020-04-07 10:41:16 +01:00
Leo Hemsted
885f3122bd fix purge functional test data task
* it doesn't delete service email reply to or letter contacts, or
  contact lists. I don't think the contact lists will ever be an issue
  but it doesn't hurt to add it to the list of things to remove.
* it doesn't remove users from organisations before deleting the users

there may be more tables that link to Service that should be deleted,
but for now just add these ones that I could spot.
2020-03-30 17:45:29 +01:00
Leo Hemsted
ef6b7d564a make migrate-ft-notification-status command dates inclusive 2019-12-09 16:03:10 +00:00
Leo Hemsted
12da82c8ca fix end_date bug in migrate ft notification status command 2019-12-06 13:46:22 +00:00
Leo Hemsted
0448bca542 make create_nightly_notification_status_for_day take notification_type
the nightly task won't be affected, it'll just trigger three times more
sub-tasks.

this doesn't need to be a two-part deploy because we only trigger this
overnight, so as long as the deploy completes in daytime we don't need
to worry about celery task signatures
2019-12-05 14:43:33 +00:00
Leo Hemsted
766d46dda7 change migrate-data-to-ft-notification-status to use the existing task
saves the reimplementation of the big sql query
2019-12-05 14:43:33 +00:00
Rebecca Law
44b7b36acd Added a command to process a row from a job. 2019-09-26 14:19:09 +01:00
Leo Hemsted
5975ae2383 remove unneccessary duped lines
as per pr comments
2019-08-30 16:49:58 +01:00
Leo Hemsted
7811010e6c fix command name and get most recent data rather than oldest
fix query to order the right way

also remove debug prints that duplicate the formatted line below
2019-08-30 12:18:00 +01:00
Rebecca Law
1c94d6d24a Added command to populate data for annual billing based on last years values. 2019-08-30 12:17:59 +01:00
Leo Hemsted
9726edf68d bump utils
also remove the `read().splitlines()` pattern from csv.reader usage,
as it's redundant. also add .vscode to gitignore to accomodate my
hipster IDE choices, and add some lines to pytest.ini so just running
`py.test` uses some useful flags
2019-08-02 12:41:03 +01:00
Rebecca Law
b39da01573 Remove white space from email branding column. 2019-07-30 14:34:23 +01:00
Rebecca Law
467d9780c1 Add email and letter branding to the add organisation command (by csv file) 2019-07-29 15:35:54 +01:00
Leo Hemsted
9d415cd292 remove unnecessary unique index
primary key provides the same control. also catch the right exception
in the related command
2019-05-16 14:36:17 +01:00
Rebecca Law
3a421a0642 Added commit 2019-05-07 16:47:43 +01:00
Rebecca Law
439b11d9c2 Oops! I need notification_type and what not. 2019-05-07 16:46:09 +01:00
Rebecca Law
ef2bbbe683 Fix billable units
There was a situation where the SMS was sent, the request timed out we got a 503 so the notification was put on the retry queue. However, the provider got the notification and sent the message. This means we didn't set the billable_units on the notification and the service will not be billed.
This PR is to fix the notifications that we can accurrately update.
2019-05-07 16:31:12 +01:00
Rebecca Law
059bd52ee9 Leave go live user empty if it's not populated in spreadsheet 2019-04-24 15:44:57 +01:00
Rebecca Law
acd47f44f0 We want to continue not break. 2019-04-24 15:37:40 +01:00
Rebecca Law
bf42fa0c49 Use the csv.reader instead. 2019-04-24 11:56:44 +01:00
Rebecca Law
c989310ac5 New command to populate the go live user and date from the beta partners spreadsheet. 2019-04-24 10:56:50 +01:00
Rebecca Law
ba8ab45edf Command to populate the volume intentions for services. 2019-04-10 13:38:12 +01:00
Rebecca Law
aca2817184 The active flag in the query was excluding some services.
The active flag wasn't always used, plus a service should always be active on the first version of the service.
2019-04-08 11:24:45 +01:00
Rebecca Law
7cb51840b5 Ignore services where an organisation was not found. 2019-04-05 17:03:11 +01:00
Rebecca Law
1848c358f3 Command to associate services to organisations.
The association is based on the email address of the user that created the service, meaning we need to look at version 1 of the service_history.
Then use the existing methods to find the organisation by email address, then add the association.
2019-04-05 15:02:58 +01:00
Rebecca Law
38b8a00344 Fix boolean columns 2019-04-05 12:09:57 +01:00
Katie Smith
1f1c94be9d Add command to get notification details from 'zips sent' files
Added a command to get more detailed information about the letters that
are listed in the files of zip files sent that are stored on S3. This takes
one or more file paths as arguments and creates a CSV file with a row for each
letter.
2019-04-04 16:21:58 +01:00
Rebecca Law
2b36678a26 Populate data from file for organisation data
Finished the command to populate organistions and domains from a spreadsheet.
Should be a one time use thing.

fix codestyle
2019-04-04 16:04:18 +01:00
Rebecca Law
cb94f949a1 New command to iterate through the files on S3 and call record_daily_sorted_counts.
There are many files from early on that have not had the sorted counts recorded.
2019-03-26 15:49:21 +00:00
Katie Smith
510e6bd7bf Update print statement in command 2019-02-06 15:34:34 +00:00
Katie Smith
c36660708f Fix codestyle 2019-02-06 14:13:45 +00:00
Rebecca Law
53858473d0 Make the replace more specific 2019-02-06 14:08:16 +00:00
Rebecca Law
abc2dbb147 Fix update statement to be case insensitive. 2019-02-06 14:08:16 +00:00
Rebecca Law
9fe9187a19 New server command to remove .gsi from the email address of all users for a given service. 2019-02-06 14:08:16 +00:00
Leo Hemsted
d3d56a3224 separate nightly tasks and other scheduled tasks.
other tasks is anything that is run on a different frequency than
nightly
2019-01-18 15:36:53 +00:00
Pea Tyczynska
d36c4d8a78 Remove now unused methods that populated template usage redis cache 2019-01-15 14:38:45 +00:00