Commit Graph

5586 Commits

Author SHA1 Message Date
Katie Smith
f6039d51e0 Add timestamp columns to ft_billing table
Added `created_at` and `updated_at` to the `ft_billing` table - having these
columns makes it easier to track down issues with the data in this table.

`created_at` is nullable initially, but will be changed to non-nullable
once the column is populated and the DAO etc. have been updated.
2018-05-22 14:32:49 +01:00
Katie Smith
b5734010b8 Merge pull request #1883 from alphagov/delete-provider-statistics-table
Add migration to drop unused provider_statistics table
2018-05-22 09:38:47 +01:00
Katie Smith
ee22365b9d Merge pull request #1880 from alphagov/pyup-update-marshmallow-2.15.1-to-2.15.3
Update marshmallow to 2.15.3
2018-05-22 09:38:39 +01:00
Katie Smith
3d8ce39984 Migration to drop unused provider_statistics table 2018-05-22 08:57:13 +01:00
Katie Smith
937fb1f529 Merge pull request #1881 from alphagov/remove-unused-endpoint
Delete unused endpoint and model
2018-05-22 08:56:29 +01:00
Katie Smith
0d4fb81235 Delete ProviderStatistics model
This is not being used anywhere, so can be deleted safely.
2018-05-21 15:03:39 +01:00
Katie Smith
71796311fa Delete unused aggregate_statistics endpoint
`@service_blueprint.route('/<uuid:service_id>/fragment/aggregate_statistics')`
is not being used anywhere, so has been removed. The `provider_statistics_dao`
can also be removed, since the function this contained was only used for
the endpoint.
2018-05-21 15:03:39 +01:00
Rebecca Law
46e4af8876 Merge pull request #1882 from alphagov/ft_billing-migration-fixes
Add rate to the primary key of ft_billing.
2018-05-21 15:00:49 +01:00
Rebecca Law
e5584348ef Add rate to the primary key of ft_billing.
Use the primary key constraint in the upsert statement (easier to read than listing all the columns)
2018-05-21 14:38:25 +01:00
Rebecca Law
4df7026ca8 Merge pull request #1878 from alphagov/fix-ft-billing-migration
Fix ft billing migration
2018-05-21 12:06:48 +01:00
Rebecca Law
e4e253ce44 Remove where clause for notification_status 2018-05-21 11:54:49 +01:00
Rebecca Law
c2b888a6af Make sure the date does not include time 2018-05-21 11:51:06 +01:00
Rebecca Law
4d8255b8d9 Merge branch 'master' into fix-ft-billing-migration 2018-05-21 11:06:31 +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
pyup-bot
84c3f53902 Update marshmallow from 2.15.1 to 2.15.3 2018-05-20 19:11:35 +01:00
pyup-bot
42583cbae7 Update pyjwt from 1.6.1 to 1.6.3 2018-05-19 18:27:32 +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
Katie Smith
4f2412056a Merge pull request #1877 from alphagov/stop-update-for-previous-year
Refactor usage queries and stop rebuilding monthly_billing when not needed.
2018-05-16 14:11:23 +01:00
Rebecca Law
3c90c0ffcd Fix code style 2018-05-16 13:18:36 +01:00
Rebecca Law
eb083e30ed - Only rebuild current month for monthly_billing if today is in the current year.
- Change the usage queries to a union so that billing_units is correct for all notification types. Removing the business logic from the schema.
- Added tests for different fragment counts, rates and sheet counts.
2018-05-16 12:21:59 +01:00
Chris Hill-Scott
de95a28b7c Merge pull request #1876 from alphagov/fire-police-logos
Add letter logos for TWFRS and Thames Valley Police
2018-05-16 11:07:18 +01:00
Chris Hill-Scott
f6b8611b18 Add letter logos for TWFRS and Thames Valley Police 2018-05-16 11:00:05 +01:00
Rebecca Law
e3179dee99 Merge pull request #1875 from alphagov/fetch-data-from-right-table
Convert the day_start from a string to a datetime.
2018-05-15 14:06:33 +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
61f1ac54ee Merge pull request #1874 from alphagov/fetch-data-from-right-table
Conditional table to fetch data for billing.
2018-05-15 13:12:30 +01:00
Rebecca Law
271ce6d76e Changed the update/insert to a postgres upsert to avoid concurrency issues. 2018-05-15 11:21:10 +01:00
Rebecca Law
3615f3d00f In order to re-run the create_nightly_billing for dates in the past, we added a condition on which table is used.
This will allow us to re-run nightly billing for those 2 days where it failed.
For the majority of time the query will run on Notiifcations.
2018-05-14 16:21:16 +01:00
Rebecca Law
a640605a7c Merge pull request #1867 from alphagov/use-ft-billing-for-usage
Update ft_billing table to use integer data types
2018-05-14 13:04:52 +01:00
Rebecca Law
828ebb6079 Fix test 2018-05-14 12:48:42 +01:00
Chris Waszczuk
0e9fca09fb Merge pull request #1855 from alphagov/inbound-sms-max-7-days
Only get inbound messages that are a maximum of 7 days old
2018-05-14 11:15:52 +01:00
Rebecca Law
56d7a7242b Fix merge conflict in db migration 2018-05-14 09:49:24 +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
8e3466f717 Merge pull request #1866 from alphagov/ft-notification-status-migration
Add ft_notification_status table and data migration command
2018-05-14 09:06:08 +01:00
Katie Smith
13f3662051 Add command to populate data 2018-05-14 08:51:32 +01:00
Katie Smith
c9dc6f724d Add FactNotificationStatus model
Added the FactNotificationStatus model for the ft_notification_status table.
2018-05-14 08:51:32 +01:00
Katie Smith
bb9eb367b7 Migration to create the ft_notification_status table
Added the migration for the `ft_notification_status` table which will be
used to look up the counts for notifications by various different
fields.

The `job_id` column is non-nullable because we want to include it in the
composite primary key. For notifications which weren't part of a job,
the `job_id` will be set to `0000-00000-0000-00000` when populating the
data.
2018-05-14 08:51:32 +01:00
Rebecca Law
d98581cfe6 Added a new endpoint for yearly usage totals using ft_billing. 2018-05-11 16:25:16 +01:00
Leo Hemsted
a9bd189a24 Merge pull request #1868 from alphagov/pyup-update-requests-mock-1.4.0-to-1.5.0
Update requests-mock to 1.5.0
2018-05-11 14:07:28 +01:00
pyup-bot
5b6f6bdc93 Update eventlet from 0.22.1 to 0.23.0 2018-05-11 11:43:46 +01:00
Leo Hemsted
9ac511e725 Merge pull request #1871 from alphagov/revert-1854-pyup-update-gunicorn-19.7.1-to-19.8.1
Revert "Update gunicorn to 19.8.1"
2018-05-11 11:29:32 +01:00
Leo Hemsted
307fd24072 Revert "Update gunicorn to 19.8.1" 2018-05-11 10:57:04 +01:00
pyup-bot
178a851d81 Update requests-mock from 1.4.0 to 1.5.0 2018-05-10 23:43:16 +01:00
Rebecca Law
99d1357c37 Fix the logging message in the nightly task 2018-05-10 17:13:38 +01:00
Rebecca Law
d50a0d4cb4 Migration script
Change to command.
2018-05-10 16:41:24 +01:00
Rebecca Law
8028f6cc28 We found that the reporting task failed twice because of integrity constraints.
This was because the rate_multiplier was being added as 1 and 1.0 which was not resolving to the same.
This updates the table to use Integrer.
Also changed the logging for the task.
2018-05-10 15:35:58 +01:00
chrisw
2abbb590ab Only get inbound messages that are a maximum of 7 days old 2018-05-10 14:00:55 +01:00
Rebecca Law
20129a2b14 Merge pull request #1854 from alphagov/pyup-update-gunicorn-19.7.1-to-19.8.1
Update gunicorn to 19.8.1
2018-05-10 12:01:15 +01:00
Rebecca Law
b4883fdd89 Merge pull request #1836 from alphagov/pyup-update-sqlalchemy-1.2.6-to-1.2.7
Update sqlalchemy to 1.2.7
2018-05-10 12:01:01 +01:00