Commit Graph

3246 Commits

Author SHA1 Message Date
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
Chris Hill-Scott
5a7de22f55 Set default branding for NHS services
The NHS is a special case because it’s not one organisation, but it does
have one consistent brand. So anyone working for an NHS organisation
should have their default branding set when they create a service, even
if we know nothing about their specific organisation.
2019-04-08 10:27:26 +01:00
Chris Hill-Scott
c257ec105c Raise exception if history can’t be written
This is fiendishly difficult error to discover on your own.

It’s caused when, during the creation of a row in the database, you run
a query on the same table, or a table that joins to the table you’re
inserting into. What I think is happening is that the database is forced
to flush the session before running the query in order to maintain
consistency.

This means that the session is clean by the time the history stuff comes
to do its work, so there’s nothing for it to copy into the history
table, and it silently fails to record history.

Hopefully raising an exception will:
- prevent this from failing silently
- save whoever comes across this issue in the future a whole load of
  time
2019-04-05 16:11:46 +01:00
Chris Hill-Scott
f26abe87b2 Merge pull request #2443 from alphagov/ignore-gsi-when-search-for-domain
Ignore gsi in email address when searching for organisation
2019-04-05 16:07:05 +01:00
Rebecca Law
36b4a344fc Update the dao_get_organisation_by_email_address to ignore .gsi in the email address. 2019-04-05 15:47:16 +01:00
Chris Hill-Scott
f62ed714f8 Add a method to guess organisation from a domain
We need this in the admin app while we still have pages that:
- talk about the data sharing and financial agreement
- but aren’t within a service (so can’t look at the service’s
  organisation)

This is a get, but it deliberately won’t work if you pass it an email
address, in order not to put personally identifying information in our
logs.
2019-04-04 10:13:19 +01:00
Leo Hemsted
c654bc1e5e Merge pull request #2433 from alphagov/billing-fix
fix create_nightly_billing date bug
2019-04-03 15:59:54 +01:00
Leo Hemsted
1c6b291a42 we cant reason about the order of sets when iterated
split out assert into three parts
2019-04-03 15:47:53 +01:00
Leo Hemsted
28bff28786 remove letter rates between tests
we only use them in ft_billing so no reason not to delete them. makes
the tests read better as it's obvious how they work too.
2019-04-03 15:34:02 +01:00
Leo Hemsted
9f1f858997 update fact_billing_dao::get_rate to use dates not datetimes
update unit tests too
2019-04-03 14:52:41 +01:00
Leo Hemsted
6f41f6c7d7 use db models instead of tuples when referring to rate objects
makes it less confusing
2019-04-03 13:08:53 +01:00
Rebecca Law
dc8159104e Update letter_raise_alert_if_no_ack_file_for_zip for new DVLA file format
When we send a zip file of letters to DVLA we expect them to send back an acknowledgement of those files.
Previously they named the files like NOTIFY.20180202091254.ACK.TXT and the contents would contain the name of the zip file we sent with a date of when they got it.
They have updated this format to mirror the format of the zip file because there was an instance where they sent 2 files of the same name so the later overwrote the first.
Since the name matches our name, there is no need to get the file from S3 but just compare file names.
2019-04-03 11:03:42 +01:00
Leo Hemsted
1dc084be54 fix nightly ft stats tables task to respect BST
the create_nightly_notification_status task runs at 00:30am UK time,
however this means that in summer datetime.today() will return the
wrong date as the server (which runs on UTC) will run the task at
23:30 (populating the wrong row in the table).

fix this to use nice tz aware functions
2019-04-02 15:15:07 +01:00
Leo Hemsted
f1b3ae553f add tests for get_london_midnight_in_utc with a date object
we sometimes call it with a timestamp, but sometimes with just a date
object. It works with both, lets add the tests to prove that
2019-04-02 11:52:37 +01:00
Leo Hemsted
3739d9055d clean up usage of dates/datetimes in performance platform tasks
* call variables unambiguous things like `start_time` or `bst_date` to
  reduce risk of passing in the wrong thing
* simplify the count_dict object - remove nested dict and start_date
  fields as superfluous
* use static datetime objects in tests rather than calculating them
  each time
2019-04-02 11:49:20 +01:00
Toby Lorne
4abbb7137a Fix sending of performance platform
The pp client converts to UTC using the convert_utc_to_bst notify util.

This requires a datatime not a date, pass it a datetime, and add an
assertion in an existing test.

I didn't want to use the midnight conversion util in the test.

Signed-off-by: Toby Lorne <toby.lornewelch-richards@digital.cabinet-office.gov.uk>
2019-04-02 09:06:39 +01:00
Leo Hemsted
1250e47cc7 Merge pull request #2425 from alphagov/remove-inbound-get
remove get for inbound sms by phone number
2019-04-01 16:43:06 +01:00