Commit Graph

3012 Commits

Author SHA1 Message Date
Rebecca Law
e731dd96ed Added units test to make sure the complaints work if the notification doesn't exist or if the notification_history doesn't exist 2019-05-22 10:03:07 +01:00
Rebecca Law
3374e03ce9 Prepare to stop inserting NotificationHistory at the time of inserting a notificaiton.
Need to remove foreign key to complaints.
Make sure if getting Notification.id we look to both tables.
2019-05-21 16:08:18 +01:00
Rebecca Law
bde1e751ad Merge pull request #2502 from alphagov/dont-update-notification-history-in-realtime
Stop updating NotificationHistory
2019-05-21 14:46:59 +01:00
Rebecca Law
56800c669d Added some better unit tests 2019-05-17 16:01:46 +01:00
Rebecca Law
198fd21f7e Update Notification history if there is a mismatch in the number of notifications to be updated and the number actually updated. 2019-05-15 15:30:15 +01:00
Rebecca Law
82d8c7014d Merge branch 'master' into dont-update-notification-history-in-realtime 2019-05-15 15:15:26 +01:00
Rebecca Law
e3ee99e70d Reduce the number of days to recalculate billing. It's not necessary to calculate longer than 4 days. 2019-05-15 14:40:53 +01:00
Rebecca Law
43334d63f3 Stop updating NotificationHistory
Doing my bit to remove imports of fixtures.
2019-05-15 10:58:39 +01:00
Katie Smith
84c35cbf67 Add request_to_go_live_notes column to Organisation table
This column will be used to stores extra notes that should go in the
Zendesk ticket when a service belonging to that organisation requests to
go live.
2019-05-13 14:45:01 +01:00
Pea Tyczynska
eec5f5490d Don't require precompiled_letter service permission
Everyone can send precompiled letters now yay
2019-05-13 13:04:29 +01:00
Katie Smith
ce24b13654 Combine two tests into one 2019-05-08 11:39:01 +01:00
Katie Smith
c809bf2207 Ensure notifications have billable units and provider if sending fails
If we try to send an SMS to the provider and the provider throws an exception
(because they return a 503 status code) the notification should retry. But if
we get the callback from the provider before the notification has been retried, the
notification will have no billable units or provider set.

To avoid this, we now set billable_units and provider even if there has been
an exception from our provider.
2019-05-08 10:54:01 +01:00
Katie Smith
cf7997d925 Change get_providers endpoint to return no of SMS sent by each provider
In addition to the existing provider data, we also want return the number of
billable units (muliplied by the rate multiplier) that each SMS provider sent
this month. This will be used on the platform admin providers page.

Since we can no longer get all the information we need from the provider details
schema, this makes a new DAO function to get all the data for the endpoint.
2019-05-07 08:31:04 +01:00
Pea Tyczynska
689ff57c32 Add organisation type to live services report 2019-05-03 15:09:54 +01:00
Rebecca Law
b89ab0cd87 Merge pull request #2487 from alphagov/dont-update-notification-history-in-realtime
Insert/update NotificationHistory just before we delete from Notifications
2019-05-02 13:57:41 +01:00
Rebecca Law
d5d2b3d2a6 Update insert to use select_from - this allows the insert query to run as a single bulk insert and should be more efficient. 2019-05-02 13:46:15 +01:00
Pea Tyczynska
e7add1c729 Only show live services in live services query 2019-05-02 11:15:53 +01:00
Pea (Malgorzata Tyczynska)
b280181a00 Merge pull request #2483 from alphagov/serialize-sent-stats
Add get_live_services_data endpoint and related query
2019-05-01 16:10:25 +01:00
Pea Tyczynska
83f39730d0 Order results by live date ascending order 2019-05-01 15:58:08 +01:00
Pea Tyczynska
382d1de857 Only count_as_live services
Add comments to live services dao test for context
2019-05-01 15:57:59 +01:00
Pea Tyczynska
c15d7878fc Only include ft_billing data for current financial year
Test get_live_services_data endpoint

Expand dao_fetch_live_services_data test with more ft_billing records
2019-05-01 15:57:45 +01:00
Pea Tyczynska
669db0b4ca New db query that returns data about live services
This data includes service and org name, consent to research,
contact details and both intended and factual notifications
volumes by notification type.

This query was created to get data for a csv report for our
platform admins.
2019-05-01 15:57:20 +01:00
Rebecca Law
0def0b7fd0 We want to staop inserting and updating NotificationHistory each time we insert/update Notification.
This PR adds a function to upsert (insert or update if exists) NotificationHistory all the rows from Notification that we are about to delete in the nightly task. This will happen just before the delete function. Since it is a upsert query the function can be called more than once.
This should allow us remove all the insert/updates to NotificationHistory.

However, there is a consern that this will double the length of time the tasks take. So do we do these upserts in a separate task or in the same one?
2019-05-01 14:26:11 +01:00
Rebecca Law
ee69e70b76 Bump requirements.
Minor weekly updated and a bump for a security alert in urllib3.
Sort list in test, to ensure it passes everytime.
2019-04-26 10:49:25 +01:00
Pea Tyczynska
454690a008 Fix bug in precompiled preview with overlay
The bug treated all pages of png preview as if they were all first
page, showing overlay for address bar
2019-04-24 18:29:01 +01:00
Rebecca Law
55a65a22a9 Added test for go_live_user and go_live_at in the response for get_service_by_id 2019-04-17 13:20:44 +01:00
Chris Hill-Scott
96bb9e19f9 Merge pull request #2385 from alphagov/raise-if-fail-to-write-history
Raise exception if history can’t be written
2019-04-17 11:17:49 +01:00
Chris Hill-Scott
8929911ad8 Merge pull request #2444 from alphagov/remove-domains-from-branding
Stop updating or reading domain columns on branding table
2019-04-15 15:35:09 +01:00
Rebecca Law
6ccb242107 Merge pull request #2458 from alphagov/remove-unused-method
Remove unused method.
2019-04-15 12:11:00 +01:00
Rebecca Law
d5ae740f83 Merge pull request #2459 from alphagov/update-response-for-duplicate-domains
The previous PR added a error handler for the wrong db exception.
2019-04-15 12:10:44 +01:00
Chris Hill-Scott
c6447c111d Don’t let admin specify branding for new service
It doesn’t need to because the API code works it all out now by looking
at the organisation.
2019-04-12 16:42:50 +01:00
Pea (Malgorzata Tyczynska)
88b31c51f5 Merge pull request #2437 from alphagov/precompiled-overlay-failed-validation
Precompiled request preview with overlay when validation fails
2019-04-12 16:14:56 +01:00
Chris Hill-Scott
ee966668bd Remove domain columns from branding table
This relationship is via the `Organisation` now; we don’t use this
column to fudge a relationship based on the user’s email address and the
matching something in these columns.
2019-04-12 15:53:17 +01:00
Chris Hill-Scott
a39ed098b8 Merge pull request #2442 from alphagov/default-branding-for-nhs-users
Set default branding for NHS services
2019-04-12 15:29:30 +01:00
Alexey Bezhan
330afab5e2 Make Firetext URL configurable through the application environment
Similar to MMG, there's a new env variable FIRETEXT_URL that can be
used to override the Firetext api URL.

This will be used to stub out both providers during the load test or
can be used to run a local API against a fake provider endpoint.
2019-04-12 12:03:58 +01:00
Rebecca Law
22fc4b693a The previous PR added a error handler for the wrong db exception.
This corrects it to look for the unique constraint.
2019-04-12 10:55:21 +01:00
Leo Hemsted
5d26724022 Merge pull request #2456 from alphagov/remove-multi-app-manifests
Remove multi app manifests
2019-04-12 10:34:49 +01:00
Rebecca Law
1c68e0f565 Remove unused method.
last_n_days was only being used in a test.
2019-04-12 10:26:46 +01:00
Rebecca Law
b7ecaa4a40 Merge pull request #2453 from alphagov/update-response-for-duplicate-domains
Return a useful message if the domain is a duplicate.
2019-04-12 09:44:29 +01:00
Pea Tyczynska
2d71aea7a1 Get rid of an unneeded flag - destination endpoint is slimmer now and doesnt need it 2019-04-11 16:33:40 +01:00
Pea Tyczynska
dd9e285684 Refactor preview_letter_template_by_notification_id 2019-04-11 14:27:57 +01:00
Pea Tyczynska
63fe210202 Also show overlay on document download of failed letter
And of course test this new flex
2019-04-11 14:27:12 +01:00
Pea Tyczynska
2f52a8fd64 Call overlaid preview for precompiled letters that fail validation
Also test precompiled letter preview with overlay
2019-04-11 14:26:59 +01:00
Chris Hill-Scott
6bfd999de2 Add method to count of live services and orgs
So that we don’t have to update the home page manually any more.
2019-04-11 13:54:43 +01:00
Leo Hemsted
575ec96b6b fix test that checks manifest contains references to all queues 2019-04-10 16:48:21 +01:00
Rebecca Law
f35960c3a3 Return a useful message if the domain is a duplicate. 2019-04-10 13:23:34 +01:00
Rebecca Law
a53340b4d7 Update the query that gets the number of notifications that have been sent under 10 seconds to use Notifications rather than NotificationHistory.
Also removed a test that is not useful
2019-04-10 10:06:27 +01:00
Rebecca Law
193ff8548c Merge pull request #2450 from alphagov/email-branding-unique-constraint
Update EmailBranding.name to be not null and unique.
2019-04-09 14:47:09 +01:00
Rebecca Law
64428368d1 Update EmailBranding.name to be not null and unique.
Needed to update old migration scripts so that the email_branding name is not null when creating the test dbs.
This should no affect the migrations elsewhere.
2019-04-09 14:33:38 +01:00
Rebecca Law
4ce2b9eaba The rstrip was not working for all file names so this changes it to a replace. 2019-04-08 12:04:14 +01:00