Commit Graph

95 Commits

Author SHA1 Message Date
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
Rebecca Law
1969c83f57 Fix letter rate bug in migtion 2018-05-17 10:06:58 +01:00
Rebecca Law
40d8f78b2b Convert the day_start from a string to a datetime. 2018-05-15 14:00:06 +01:00
Rebecca Law
2ae4cf18e8 Merge branch 'use-ft-billing-for-usage' of github.com:alphagov/notifications-api 2018-05-14 09:16:40 +01:00
Katie Smith
13f3662051 Add command to populate data 2018-05-14 08:51:32 +01:00
Rebecca Law
d50a0d4cb4 Migration script
Change to command.
2018-05-10 16:41:24 +01:00
Rebecca Law
844f5b2e5d Added logging message if the comparison failed. 2018-05-08 16:32:28 +01:00
Rebecca Law
fd6e5f39cf Changes as per requested from code review
Move the serialize method to the billing_schema
Update variable names
Improve tests
Fix bug in command
2018-05-08 12:09:29 +01:00
Rebecca Law
ea3523199a New endpoint to get monthly billing usage from the ft_billing table.
New command to compare the results of monthly billing to ft_billing.
2018-05-04 13:09:14 +01:00
Rebecca Law
0520dfdb60 Added a command to rebuild the data for a given service_id and date 2018-04-26 15:39:04 +01:00
Rebecca Law
a91b46dfa9 Added the else so the entire table does not rebuild. 2018-04-23 16:16:41 +01:00
Rebecca Law
12796051f5 We need to rebuild the monthly billing for one service for the month of March.
This change makes that possible without affecting any other data in the table.
2018-04-23 13:53:47 +01:00
Leo Hemsted
ac0b2d79a2 sys.exit rather than throwing an assertion error
Assertions should only be used in tests - they can be disabled at
runtime by setting the python flag -O (though I don't believe we use
that flag under normal circumstances).

also clean up test asserts - mock_redis is the redis object, so its
`called` property will always be false, because we never say
`redis_store()`. Rather, we should use the `mock_calls` property to
see all calls to all of its children
2018-04-09 11:45:43 +01:00
Leo Hemsted
ba612b0f5b make sure redis command filters dates properly
also write the tests that i should have written a while ago for this
2018-04-05 15:11:29 +01:00
Leo Hemsted
6e554188bd add command to backfill template usage
The command takes a service id and a day, grabs the historical data for
that day (potentially out of notification_history), and pops it in
redis (for eight days, same as if it were written to manually).

also, prefix template usage key with "service" to make clear that it's
a service id, and not an individual template id.
2018-04-03 16:14:47 +01:00
venusbb
2262db4f62 Database tweak and BST bug fix 2018-03-27 10:37:56 +01:00
Rebecca Law
fc21121764 Check input is a UUID 2018-03-23 16:11:43 +00:00
Rebecca Law
6dad9b43db New command to create-pdf-letter task for a given notification id.
After a notificaiton is created we create a task to create the pdf and save it to S3,
if for some reason that task does not run we are left with notifications that are not sent.
This should not happen, but if it does we have a way to continue sending the letter.
2018-03-23 15:47:01 +00:00
venusbb
444365faa5 add statd 2018-03-22 17:17:03 +00:00
venusbb
9aa2536997 use sql parametrize rather than python format 2018-03-21 17:04:51 +00:00
venusbb
4b25654cbf update record rather than ignore when duplicate 2018-03-21 15:37:49 +00:00
venusbb
b9953dd005 Command to migrate data to ft_billing 2018-03-21 15:21:16 +00:00
Rebecca Law
a3d04ca672 Improve log message 2018-03-09 12:01:08 +00:00
Rebecca Law
e95740a6b5 There was a problem with the worker that was sending the service updates for the notification.
The problem has been resolved but we need to replay the messages that are missing. We have been sent a file containing client_references for all the notificaitons that the service would needs updates for.
2018-03-09 11:06:47 +00:00
Chris Hill-Scott
5db3eef8f2 Add warning to Performance Platform command 2018-03-06 15:42:38 +00:00
Chris Hill-Scott
ca167206d5 Add command to backfill Performance Platform totals
We don’t have any way of playing back the totals we send to performance
platform.

This commit copies the command used to backfill the processing time and
adapts it to backfill the totals instead. Under the hood it uses the
same code that we use in the scheduled tasks to update performance
platform on a daily basis. I had to modify this code to take a `day`
argument because it was hardcoded to only work for ‘yesterday’.
2018-03-05 17:02:33 +00:00