Commit Graph

5586 Commits

Author SHA1 Message Date
Rebecca Law
ff2334937c Last night we had some letter notifications that were in permanent failure and had page count = 0.
This causes the create-nighlty-billing task to fail.
This will make sure that 0 is returned in this case.
2018-07-31 11:04:48 +01:00
Alexey Bezhan
536154d79f Merge pull request #2017 from alphagov/pyup-ignore-requirements-txt
Make pyup ignore requirements.txt
2018-07-31 11:01:12 +01:00
Alexey Bezhan
ce5bb1f762 Make pyup ignore requirements.txt
We don't want pyup.io upgrading sub-dependencies listed in the
requirements.txt file since it does it whenever a new version is
available regardless of what our application dependencies require.
2018-07-30 16:26:10 +01:00
Chris Hill-Scott
b8913b62ec Fix broken Markdown headings in README 2018-07-30 15:25:48 +01:00
Pea (Malgorzata Tyczynska)
018585eccc Merge pull request #1981 from alphagov/get_rid_of_monthly_billing
Remove monthly_billing table and all references to it
2018-07-30 11:48:34 +01:00
Pea Tyczynska
b28ec8beda Use old monthly_billing-related routes for new functions 2018-07-30 11:33:15 +01:00
Pea Tyczynska
4e49df2479 Delete MonthlyBilling model 2018-07-30 11:07:42 +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
1d2e086109 Merge pull request #1994 from alphagov/fix-billing-update
make rebuild-ft-billing-for-day remove unused rows
2018-07-30 09:58:29 +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
Tom Byers
f16c83954c Merge pull request #1988 from alphagov/add-spacing-changes-to-email-template
Brings in spacing changes to the email template
2018-07-25 15:48:07 +01:00
Tom Byers
d6603a0541 Brings in spacing changes to the email template 2018-07-25 15:28:23 +01:00
Rebecca Law
3a75a58c97 Merge pull request #1987 from alphagov/fix-unique-key-service_callback_api
Fix unique constraint on ServiceCallbackApi
2018-07-25 14:24:52 +01:00
Rebecca Law
2b0ec9353e Added missing migration file 2018-07-25 14:16:36 +01:00
Rebecca Law
a812060915 The unique constraint on SeviceCallbackApi was on service_id only.
Now that we have 2 types of api callbacks the constraint to be on service_id + callback_type.
2018-07-25 14:12:13 +01:00
Rebecca Law
e4bef01ae1 Merge pull request #1983 from alphagov/increase-days-to-calc-billing
Increase the number of days we calculate billing from 3 to 10 days.
2018-07-25 10:32:45 +01:00
Rebecca Law
4fc004b00a Increase the number of days we calculate billing from 3 to 10 days.
Log exception if the billing counts for letters are different in the dvla response file than what we collected.
2018-07-24 16:28:30 +01:00
Pea (Malgorzata Tyczynska)
1b21a12b83 Merge pull request #1971 from alphagov/add_task_to_send_complaints_on
Add and call task to send complaints on to service callback APIs
2018-07-24 15:07:09 +01:00
Rebecca Law
0675f09afb Need to be able to query the notification statistics for the right number of days.
If the request is for the big numbers on the activity page, then we need to use the number right number of days.
Added an end point to get the data retention for the service and notification type, which is needed on the activity page to say how long the report is available for.
2018-07-23 09:56:04 +01:00
Rebecca Law
dae29a1b61 Update the query for the notifications activity page to return the data for the days of retention if set. 2018-07-23 09:56:04 +01:00
Rebecca Law
9674005c71 Updated the function to delete notifications over a week old to look at ServiceDataRetention to only delete notifications specified number of days for the notification type. 2018-07-23 09:56:03 +01:00
Leo Hemsted
d61300accb Merge pull request #1944 from alphagov/research-letter-time
create fake letter response files with variables timestamps
2018-07-20 12:22:44 +01:00
Leo Hemsted
5c4f3e246c make test dvla response file timestamps in a random order
since there'll be a bunch of threads running functional test tasks at
the same time, there's no point always trying to start from the same
second and then stepping back to the same one-second-back file each
time. Also, this leads us to an increased risk of race conditions.

This change takes the same thirty second range, but shuffles it. The
tests, since they're no longer deterministic, now use a new Matcher
object (w/ credit to alexey) to match any filename from within that
thirty second range
2018-07-20 12:09:00 +01:00
Leo Hemsted
0cfed3f514 create fake letter response files with variables timestamps
when a test letter is created on dev or preview, we upload a file to
the dvla ftp response bucket, to test that our integration with s3
works. s3 triggers an sns notification, which we pick up, and then we
download the file and mark the letters it mentions as delivered.

However, if two tests run at the same time, they'll create the same
file on s3. One will just overwrite the next, and the first letter will
never move into delivered - this was causing functional tests to
intermittently fail.

This commit makes the test letter task check if the file exists - if it
does, it moves back one second and tries again. It tries this thirty
times before giving up.
2018-07-20 12:09:00 +01:00
Leo Hemsted
6e87b36303 remove duplication shutdown loggers
also add **kwargs to make it celery4 compatible
2018-07-20 12:09:00 +01:00
Pea Tyczynska
3048c05850 Revert notification_id name change in delivery_status service_callback_task data 2018-07-20 11:22:38 +01:00
Katie Smith
87013d9399 Merge pull request #1970 from alphagov/notification-serialize-includes-sender
Include the notification sender name when serializing notifications
2018-07-20 10:39:48 +01:00
Katie Smith
af5c4d2872 Include the notification sender name when serializing notifications
The `serialize` method of the Notification model now includes the
`created_by_name`. If a notification was sent as a one-off message this
value will now be the name of the person who sent the notification. If
a notification was sent through the API or by a CSV upload we don't
record the id of the sender, so `created_by_name` will be `None`.

This change affects the data that gets returned from these endpoints:
* /v2/notifications/<notification_id>
* /v2/notifications
2018-07-20 09:37:50 +01:00
Pea Tyczynska
812f4d20dd Send complaints on to service callback APIs using an async task 2018-07-19 16:59:39 +01:00
Katie Smith
ff3a71a9ea Merge pull request #1963 from alphagov/get-one-messages-by-default
Add one_off filter when getting all notifications for a service
2018-07-19 10:26:54 +01:00
Katie Smith
b1cfa8942a Add one_off filter when getting all notifications for a service
Added the option to filter by one_off messages to the DAO function
`get_notifications_for_service`. Previously, one-off notifications
were not returned - this has changed so that the default is for
one-off notifications to be returned. Also simplified the `include_jobs`
filter for this function.

The DAO function gets used in 3 places - for the V1 and V2 API endpoints,
which will now start to return one-off messages. It also gets used by
the admin app which needs to pass in `include_one_off=False` to the
`get_all_notifications_for_service` where we don't want one-off
notifications to show, such as the API message log page.
2018-07-18 15:08:06 +01:00
Alexey Bezhan
8d48f41776 Merge pull request #1966 from alphagov/set-callback-history-type
Add callback_type to service callback history records
2018-07-18 14:57:16 +01:00
Alexey Bezhan
778909b189 Add callback_type to service callback history records
We've updated the current service callbacks to add callback types
in #1964, but since the table is versioned we also need to add a
type to the history records.

Even though they're not used anywhere at the moment this might make
it easier to restore from a history callback record in the future.
2018-07-18 13:57:42 +01:00
Pea (Malgorzata Tyczynska)
946e0b2700 Merge pull request #1964 from alphagov/send_complaints_to_service_teams
Send complaints to service teams
2018-07-18 13:19:34 +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
Pea Tyczynska
e81c395ab1 Assign delivery_status type to existing callbacks 2018-07-18 11:36:39 +01:00
Pea (Malgorzata Tyczynska)
8113d0e48f Merge pull request #1958 from alphagov/send_complaints_to_service_teams
Add callback_type column to service_callback_api table
2018-07-18 10:30:31 +01:00
Pea Tyczynska
183aa160c6 Add callback_type column to service_callback_api table
Also add service_callback_type table with allowed types
2018-07-17 16:54:00 +01:00
Rebecca Law
9c99e45008 Merge pull request #1945 from alphagov/flexible-data-retention
Flexible data retention
2018-07-17 16:03:18 +01:00
Chris Hill-Scott
081c7c7083 Merge pull request #1957 from alphagov/quis-patch-1
Bump utils to fix smart quotes in email addresses
2018-07-17 14:32:28 +01:00
Chris Hill-Scott
222dc3fe95 Use debian jessie instead of stretch until npm is installed differently 2018-07-17 11:59:48 +01:00
Chris Hill-Scott
89d20033a8 Bump utils to fix smart quotes in email addresses
Brings in:
- [ ] https://github.com/alphagov/notifications-utils/pull/500
2018-07-17 11:22:22 +01:00
Pea (Malgorzata Tyczynska)
48d1e816ef Merge pull request #1943 from alphagov/admin_platform_users_search
Add data endpoint for finding users by full or partial email
2018-07-16 15:47:23 +01:00
Alexey Bezhan
cbaa8cceee Merge pull request #1938 from alphagov/pin-all-requirements
Pin all application requirements in requirements.txt
2018-07-16 14:07:08 +01:00
Pea Tyczynska
a69dee5e6d Move code that escapes special chars to helper function and use it
in query get_users_by_partial_email
2018-07-13 15:47:21 +01:00
Pea Tyczynska
782a8ab9e7 Add data endpoint for finding users by full or partial email 2018-07-13 15:47:20 +01:00
Rebecca Law
ab695d24d5 Added new endpoints to get service data retention for a service. 2018-07-13 15:18:27 +01:00
Rebecca Law
e2a1dfeb31 New dao and endpoints to create and update service data retention. 2018-07-11 17:02:49 +01:00
Leo Hemsted
d88003d143 Merge pull request #1940 from alphagov/dashboard-day-limit
Sort out the dashboard day limits
2018-07-11 16:07:31 +01:00