Commit Graph

270 Commits

Author SHA1 Message Date
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
Pea Tyczynska
fd06924f3a Build a command to archive old jobs 2018-11-28 14:38:59 +00:00
Pea Tyczynska
1c4d2c7625 Update existing ft_notification_status data to get rid of repeats 2018-11-08 11:52:40 +00:00
Leo Hemsted
267c4fc07b bump requirements, fix pyflake8 things, unpin botocore/awscli 2018-11-07 13:39:08 +00:00
Katie Smith
0b5da2b8ad Update command to migrate data to ft_billing
Updated the 'migrate-data-to-ft-billing' command to populate the new
postage column of ft_billing. This will be populated with the
postage of the notification for letters, or 'none' for email or sms. We
need to ensure there are no null values in postage so that the postage
column can become part of the primary key later.

Also updated the query to get the right rate letter rate now that we are
updating rates in the letter_rates table.
2018-09-28 13:52:17 +01:00
Leo Hemsted
7496178156 populate historic notification postage data
sets all letters in notification history (and notifications) to
"second", so that there's no null letters for billing etc. Commits in
ten day chunks (up to ~30k letters)
2018-09-20 17:41:04 +01:00
Pea Tyczynska
b28ec8beda Use old monthly_billing-related routes for new functions 2018-07-30 11:33:15 +01:00
Pea Tyczynska
ca2b350a99 Remove references to monthly_billing table from api 2018-07-30 11:07:42 +01:00
Pea Tyczynska
c0f309a2a6 Delete scheduled task to populate monthly_billing 2018-07-30 11:06:04 +01:00
Leo Hemsted
a826f6e924 make rebuild-ft-billing-for-day remove unused rows
if the billing data was incorrect and needs to be rebuilt, we should
remove old rows. Previously we were only upserting new rows, but old
no-longer-relevant rows were staying in the database. This commit
makes the flask command remove *all* rows for that service and day,
before inserting the rows from the original notification data after.

This commit doesn't change the existing nightly task, nor does it
change the upsert that happens upon viewing the usage page. In normal
usage, there should never be a case where the number of billable units
for a rate decreases. It should only ever increase, thus, never need to
be deleted
2018-07-26 19:10:30 +01:00
Pea Tyczynska
86978c225a Filter 'get_service_callback_api_for_service' to only get status updates
Also rename it to 'get_service_delivery_status_callback_api_for_service'
2018-07-18 11:36:39 +01:00
Leo Hemsted
4502dffa13 include date being processed in the migrate nightly stats command 2018-07-04 14:54:27 +01:00
Rebecca Law
f4846c88c9 Had to move the import to the method rather than the top of the file. 2018-06-29 11:12:54 +01:00
Rebecca Law
213e32cf6d Added a one off command to add many invited user to a service.
It would be nice to add something that can do this from the Admin app.
2018-06-28 17:09:45 +01:00
Rebecca Law
16bb62e029 Due to a bug in 2016, there are some rows without a template id.
For that case use a default template id.
2018-06-20 14:51:24 +01:00
Rebecca Law
15e81aa7b3 Update to the command to migrate data for ft_notification_status.
Removed the initial queries - I don't think they are helpful.
2018-06-20 14:04:03 +01:00
Katie Smith
4d27972c90 Add created_at and updated_at columns to ft_notification_status
Added created_at and updated_at to the ft_notification_status table in order
to make it easier to track down any potential issues with the data.

Also updated the command to populate the data to take created_at and
updated_at into account and to simplify the command. This can all be done in
the same commit since the table is not being used anywhere yet and can
only be populated manually.
2018-05-24 10:51:38 +01:00
Katie Smith
c6c118fea1 Update created_at column of ft_billing to be non-nullable
`created_at` was added previously and made nullable temporarily. This
commit now populates the column, ensures that it will always have a
value, and makes `created_at` non-nullable.
2018-05-23 11:09:13 +01:00
Rebecca Law
e4e253ce44 Remove where clause for notification_status 2018-05-21 11:54:49 +01:00
Rebecca Law
9fad623d91 Update the ft_billing query to only include billable notification status types.
Update test_provider_statistics dao - this is really irrelevant since the endpoint using the query is not being used. We have a PR coming to delete the unused code.
Update rate_multiplier to always be an integer
2018-05-21 10:56:16 +01:00
Rebecca Law
64aec4a64c Update the command to migrate data for ft_billing.
There is a massive performance improvement.
Another commit will need to alter the pk to include rate.
2018-05-18 17:22:51 +01:00
Rebecca Law
4b36fe0d9e Use created_at for the rate, there are some rows that do not have a sent_at set. 2018-05-17 13:37:55 +01:00