Commit Graph

47 Commits

Author SHA1 Message Date
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
Rebecca Law
28925da575 Fix codestyle 2018-02-21 11:52:52 +00:00
Rebecca Law
9207325501 Added a message about the file format. 2018-02-21 10:30:34 +00:00
Rebecca Law
953a545aea Added a command to insert inbound numbers from file.
Expected file format is one number per line, each phone number should be 07... not 447..
2018-02-21 10:00:17 +00:00
Rebecca Law
995d70740a Add letter type when getting billing data for financial year 2017-12-18 10:40:13 +00:00
Rebecca Law
e0e64d51d5 [WIP]
Fix the query to count rather than sum the billing units.
Need to fix the query that returns the monhtly billing, there is only one row but there should be two if there are two rates.
2017-12-15 17:29:32 +00:00
Rebecca Law
012d80003a Update montly billing with letters 2017-12-14 17:17:05 +00:00
Leo Hemsted
a4e2a40134 update dao tests to pass in free sms fragment limit, remove command 2017-12-06 14:45:43 +00:00
Leo Hemsted
5b7118973e take advantage of click's type validation/coercion
(saves us having to write the stuff ourselves). Also adds a small
click plugin to do datetime parsing.

Sample output:

```
[leohemsted:~/dev/api]$ flask command create_provider_rates --help
Usage: flask command create_provider_rates [OPTIONS]

  Backfill rates for a given provider

Options:
  -p, --provider_name [mmg|firetext|ses]
                                  [required]
  -c, --cost FLOAT                Cost (pence) per message including decimals
                                  [required]
  -d, --valid_from DATE           [required]
  --help                          Show this message and exit.
[leohemsted:~/dev/api]$ flask command create_provider_rates -p ses -c 1.234 -d invalid
Usage: flask command create_provider_rates [OPTIONS]

Error: Invalid value for "-d" / "--valid_from": Could not parse datetime string "invalid" formatted as %Y-%m-%dT%H:%M:%S
```
2017-11-28 12:50:29 +00:00
Leo Hemsted
721202b44f use more click functionality to reduce our own codes' complexity 2017-11-28 10:35:46 +00:00
Leo Hemsted
4c14e3279f ensure the app context is included in every single flask command 2017-11-24 12:01:28 +00:00
Leo Hemsted
cd6f85281c any apps that use current_app need to be in a context
to achieve this, the decorator flask.cli.with_appcontext is used. Not sure why it
hasn't applied by default /shrug
2017-11-23 17:04:58 +00:00
Leo Hemsted
e2e9db8c97 add docstrings for all custom commands 2017-11-23 17:04:58 +00:00
Leo Hemsted
9f56dccdee Remove flask-script, move commands to click
click (http://click.pocoo.org/) is used by flask to run its cli args.
In removing flask_script (it's unmaintained), we had to migrate all our
commands to use click. This is a change for the better in my eyes - you
don't need to define the command in several places, and it makes
managing options a bit easier.

View diff with whitespace turned off unless you're a masochist.
2017-11-23 17:04:58 +00:00
Rebecca Law
c8a210afd1 Added a command to re-run the build_dvla_file for a given job id.
There was an instance where the file failed to create because the address in the personalisation had punctuation which caused the address lines to merge into one.
Utils has been updated to fix that problem, this task will allow us to re-run the task so that the notifications can be sent.
2017-10-31 15:20:14 +00:00
venusbb
b2fa7cdd83 create new table annual_billing 2017-10-18 15:35:51 +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
Venus Bailey
616a6f8ef8 Revert "[#151837054] Add new column free_sms_fragment_limit in the Services table" 2017-10-16 12:43:05 +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
Imdad Ahad
1dd3298290 Add command to populate new service letter contact table from existing data 2017-10-02 11:46:19 +01:00
Rebecca Law
f2928e6c55 Migration server command to create one row in Service_sms_senders for each service. 2017-09-22 16:27:23 +01:00
Rebecca Law
9bd3ed2dac Use a unique id 2017-09-12 09:30:55 +01:00
Imdad Ahad
e119ced7c1 Add command to populate service_email_reply_to:
* Insert new entries for unpopulated services
* Exclude services who do not have a reply to set
2017-09-08 15:27:49 +01:00
Leo Hemsted
378b131c59 add batch task to backfill processing time data
give it a start date and an end date, and it'll send data to the
performance platform for all dates in that (inclusive)
2017-08-31 14:41:05 +01:00
Leo Hemsted
9fcd54c12b unindent old fn 2017-08-31 14:41:05 +01:00
Leo Hemsted
ae683cad6e Merge pull request #1192 from alphagov/deps
update dependencies
2017-08-22 15:39:49 +01:00
Ken Tsang
27ccbb0cd1 Removed trailing whitespace 2017-08-21 13:31:35 +01:00
Leo Hemsted
c36e50bef1 update dependencies 2017-08-18 17:02:31 +01:00
Ken Tsang
39cb66a882 Update script to only update unassigned inbound 2017-08-18 11:49:05 +01:00
Ken Tsang
e6582b90be Add db command to update inbound_numbers
Updates the service_id with the service.id that matches the sms_sender
2017-08-18 11:49:05 +01:00
Imdad Ahad
9b88dadb83 Update command populate billing data for services that require it 2017-08-16 15:15:34 +01:00
Imdad Ahad
46ca086aa2 Update command to populate monthly billing data for email and sms 2017-08-11 16:57:18 +01:00
Imdad Ahad
5b9377c697 Start populating monthly billing on a schedule 2017-08-02 15:32:32 +01:00
Imdad Ahad
a08de0939b Adjust command to backfill (less granular)
Rates began from 05-2016

This adjusts the command to backfill by year.

If 2016, let's backfill from May.
If 2017, let's backfill from the beginning of the year.
2017-08-01 11:36:30 +01:00
Rebecca Law
c1f2634c90 Removed month and year and replaced it with start_date and end_date.
This will allow us to sort the data properly.
2017-07-26 13:19:17 +01:00
Rebecca Law
9400988d72 Monthly billing - part 1
This is still a work in progress but it would be good to get some eyes on it.
This commit includes creating and updating a row in the monthly billing table and a method to fetch the results.
There is a command to populate the monthly billing for a service and month so we can try it out.
The total cost at the moment are wrong, they do not take into account the free allowance - see notes below about adding that to the table.
Left to do:
create a nightly task to run to update the monthly totals.
create an endpoint to return the yearly billing, the current day will need to be calculated on the fly and added to the totals.
Add the free allowance into the total costs.
2017-07-18 18:21:35 +01:00
Imdad Ahad
6ce93e0cf4 Add len(results) 2017-07-06 12:30:09 +01:00
Imdad Ahad
ea9fc2f81f Use max in select 2017-07-06 12:30:09 +01:00
Imdad Ahad
12800f7cbf Add a script to correct out-of-sync notifications 2017-07-06 12:30:09 +01:00
Imdad Ahad
b2651180eb Updates:
* Refactor custom db script to allow passing in a specific command function
* Add script to update new Notification status
2017-07-06 12:27:54 +01:00
Rebecca Law
54f7e732d9 Fix typo 2017-05-23 15:36:33 +01:00
Rebecca Law
6536177ac2 Added the delete query for notifications 2017-05-23 13:35:15 +01:00
Rebecca Law
2e864411af Create a server command to run custom db scripts. 2017-05-19 17:04:39 +01:00
Nicholas Staples
15607c0977 Add server_commands and update readme.md
Update command to search for services from the user.
2016-05-18 12:20:56 +01:00
Nicholas Staples
d40d9f76d4 Purge functional tests command added with passing test.
Code quality fix.
2016-05-06 11:16:30 +01:00
Nicholas Staples
3b1423a2ea Provider Statistics added.
Rates command added with a test.

Updated to include added migration.
2016-04-21 13:47:04 +01:00