Commit Graph

11293 Commits

Author SHA1 Message Date
Pea Tyczynska
daba419b39 Fix tests - add flake8 exception and change endpoint name in navigation tests 2021-03-30 15:16:02 +01:00
Pea Tyczynska
f7142a1518 Catch validation error from API
When dates chosen for billing report are not in the same
financial year, API throws an error. This error was not being
caught so far. This PR starts to catch it and display a banner
with error message on the page, instead of page crashing.
2021-03-30 14:13:57 +01:00
Pea Tyczynska
38cfee6390 Rename usage report to billing report
Because only services with bills to pay are included, and
we started including billing details.

Also rename endpoints and file names to match this.
2021-03-30 14:13:54 +01:00
Pea Tyczynska
95f46ced8a Add billing details fields to Usage for all services report 2021-03-30 14:11:42 +01:00
Pea Tyczynska
2a9ebfb1cc Merge pull request #3849 from alphagov/allow-double-hyphens-in-email-domains
Bump utils to allow double hyphens in email address domain
2021-03-30 11:06:14 +01:00
Pea Tyczynska
a631942d55 Bump utils to allow double hyphens in email address domain
It was requested by our user and it is an allowed domain format
with Amazon SES, so we started allowing it in our validation.
2021-03-29 17:38:37 +01:00
Chris Hill-Scott
f0696cfaa7 Merge pull request #3845 from alphagov/refactor-broadcast-areas
Refactor BroadcastAreas to reuse common methods
2021-03-22 12:20:53 +00:00
Chris Hill-Scott
fc75d60f65 Refactor BroadcastAreas to reuse common methods
This commit makes an abstract base class for broadcast areas, so that
methods and properties which are common between `BroadcastArea`s (those
which come from our library) and `CustomBroadcastArea`s (those supplied
via the API) can be shared.
2021-03-22 11:07:43 +00:00
Chris Hill-Scott
ddfc60cde6 Merge pull request #3838 from alphagov/pyup-scheduled-update-2021-03-15
Scheduled weekly dependency update for week 11
2021-03-22 10:56:31 +00:00
Chris Hill-Scott
1699f1f0b1 Manually upgrade packages with vulnerabilities 2021-03-22 10:43:01 +00:00
Chris Hill-Scott
d426fcac74 Freeze requirements 2021-03-22 10:21:33 +00:00
Chris Hill-Scott
aa2a10c843 Merge pull request #3833 from alphagov/vary-bleed-by-population-density
Vary bleed amount based on population density
2021-03-22 10:03:19 +00:00
Chris Hill-Scott
40e25721ea Merge pull request #3843 from alphagov/refactor-failed-login-count
Refactor failed login count
2021-03-22 10:03:04 +00:00
Chris Hill-Scott
57aa994ce9 Add docstring 2021-03-19 15:47:18 +00:00
Chris Hill-Scott
a74db6eaa7 Handle areas which don’t have population data
If an area has a `count_of_phones` value of `0` it means we don’t have
data about the population.

This means we can’t do the maths to work out the estimated bleed. So we
should return the default amount of bleed of 1,500m instead, which is
something in between what we’d expect for a built up area and a rural
area.
2021-03-19 15:47:18 +00:00
Chris Hill-Scott
4367908269 Add limits to max/min bleed
This prevents us from giving unrealistically large or small bleed
estimates in case we have areas which are more dense or less dense than
the most/least dense areas we currently have.

Also means we don’t have to treat City of London as a special case.
2021-03-19 15:47:18 +00:00
Chris Hill-Scott
6c8bfdc5b0 Refactor failed login count
We don’t vary this between different environments so it doesn’t need to
be in the config.

I was trying to look up what this value was and found it a bit confusing
that it was spread across multiple places.
2021-03-19 15:20:11 +00:00
Leo Hemsted
62ce3c0696 Merge pull request #3842 from alphagov/remove-last-of-the-backwards-compat-invite-stuff
Remove last of the backwards compat invite stuff
2021-03-18 16:46:01 +00:00
Chris Hill-Scott
2a7f972a8a Merge pull request #3821 from alphagov/find-services-by-id
Support service IDs in ‘find services by name’
2021-03-18 13:16:36 +00:00
Ben Thorner
b5018725a1 Merge pull request #3819 from alphagov/simplify-nav-excludes
Simplify tests for excluded navigation endpoints
2021-03-18 12:25:24 +00:00
Chris Hill-Scott
738ac1d818 Vary bleed amount based on population density
There are basically two kinds of 4G masts:

Frequency | Range       | Bandwidth
----------|-------------|----------------------------------
800MHz    | Long (500m) | Low (can handle a bit of traffic)
1800Mhz   | Short (5km) | High (can handle lots of traffic)

The 1800Mhz masts are better in terms of how much traffic they can
handle and how fast a connection they provide. But because they have
quite short range, it’s only economical to install them in very built up
areas†.

In more rural areas the 800MHz masts are better because they cover a
wider area, and have enough bandwidth for the lower population density.

The net effect of this is that cell broadcasts in rural areas are likely
to bleed further, because the masts they are being broadcast from are
less precise.

We can use population density as a proxy for how likely it is to be
covered by 1800Mhz masts, and therefore how much bleed we should expect.
So this commit varies the amount of bleed shown based on the population
density.

I came up with the formula based on 3 fixed points:
- The most remote areas (for example the Scottish Highlands) should have
  the highest average bleed, estimated at 5km
- An town, like Crewe, should have about the same bleed as we were
  estimating before (1.5km) – Pete D thinks this is about right based on
  his knowledge of the area around his office in Crewe
- The most built up areas, like London boroughs, could have as little as
  500m of bleed

Based on these three figures I came up with the following formula, which
roughly gives the right bleed distance (`b`) for each of their population
densities (`d`):
```
b = 5900 - (log10(d) × 1_250)
```

Plotted on a curve it looks like this:

This is based on averages – remember that the UI shows where is _likely_
to receive the alert, based on bleed, not where it’s _possible_ to
receive the alert.

Here’s what it looks like on the map:

---

†There are some additional subtleties which make this not strictly true:
- The 800Mhz masts are also used in built up areas to fill in the gaps
  between the areas covered by the 1800Mhz masts
- Switching between masts is inefficient, so if you’re moving fast
  through a built up area (for example on a train) your phone will only
  use the 800MHz masts so that you have to handoff from one mast to
  another less often
2021-03-18 09:37:23 +00:00
Katie Smith
776e24a215 Merge pull request #3840 from alphagov/accounts-page-fix
Fix /accounts page to only show trial services once
2021-03-17 15:29:07 +00:00
Leo Hemsted
0d350bdaf8 remove invited_user from session entirely
now that we no longer set it since
https://github.com/alphagov/notifications-admin/pull/3841 was merged, we
don't need to remove it either. And we can remove checks that expect it
when cleaning up the session. And the unit tests that make sure we
ignore it if it's in the session.

So long, session['invited_user'] and session['invited_org_user']!
2021-03-17 12:27:26 +00:00
Leo Hemsted
fb1345494c Merge pull request #3841 from alphagov/remove-old-invite-stuff
stop putting invite user objects in the session
2021-03-17 12:27:04 +00:00
Ben Thorner
08cb4a2576 Simplify tests for excluded navigation endpoints
Previously each navigation class had a list of endpoint to "exclude",
which was only used in tests to ensure that all endpoints in the app
were covered: either they are present in navigation, or excluded.

However, over time the "exclude" lists have grown long and repetitive,
and maintaining each of them individually adds extra work [1][2]. This
switches to a more DRY approach, where the list of excluded endpoints
is defined once, close to the single point of use in the test.

Note the resulting test is _slightly_ less prescriptive, as it will now
pass if an endpoint exist one in navigation, even if it should also
exist in another. This seems a reasonable compromise.

[1]: https://github.com/alphagov/notifications-admin/pull/3788/files#r572809972
[2]: https://github.com/alphagov/notifications-admin/pull/3794/files#diff-39387df3a9f89b313976957e7b5457be20deab1017b2d895541b142b957f1972
2021-03-17 12:06:27 +00:00
Leo Hemsted
8a2fec6f18 stop putting invite user objects in the session
the invited_user objects can be arbitrarily large, and when we put them
in the session we risk going over the session cookie's 4kb size limit.
since https://github.com/alphagov/notifications-admin/pull/3827 was
merged, we store the user id in the session. Now that's been live for a
day or two we can safely stop putting the rich object in the session.

Needed to change a bunch of tests for this to make sure appropriate
mocks were set. Also some tests were accidentally re-using fake_uuid.

Still pop the object when cleaning up sessions. We'll need to remove
that in a future PR.
2021-03-16 18:14:04 +00:00
Katie Smith
82733d615f Delete User properties which are now no longer used 2021-03-16 15:45:21 +00:00
Katie Smith
a33b6e0a0d Fix /accounts page to only show trial services once
The `/accounts` page was listing trial mode services twice if a user
belonged to an org. They were shown under both the 'Live services' and
'Trial mode services' sections. After this change, 'Live services' will
show all live services (whether or not they belong to an org) and 'Trial
mode services' will show all trial mode services. If a user belongs to an
org, they will also see the summary of how many services per org at the
top of the page.

A couple of services in tests were renamed for clarity.
2021-03-16 15:34:35 +00:00
Chris Hill-Scott
01c651d224 Merge pull request #3836 from alphagov/remove-performance-platform-report
Remove performance platform report
2021-03-16 10:19:28 +00:00
Chris Hill-Scott
7ee9b46744 Merge pull request #3837 from alphagov/fix-psort-order-performance-page
Fix sort order on performance page
2021-03-16 10:19:23 +00:00
karlchillmaid
1a63c2c8be Merge pull request #3817 from alphagov/update-roadmap-feb-2021
Update roadmap content (March 2021)
2021-03-15 13:58:49 +00:00
pyup-bot
375b45d5ea Update xlrd from 1.2.0 to 2.0.1 2021-03-15 13:55:08 +00:00
pyup-bot
f0552c7b47 Update openpyxl from 3.0.6 to 3.0.7 2021-03-15 13:55:08 +00:00
pyup-bot
7393263dc0 Update idna from 2.10 to 3.1 2021-03-15 13:55:07 +00:00
pyup-bot
8d2b5ae142 Update docutils from 0.15.2 to 0.16 2021-03-15 13:55:07 +00:00
pyup-bot
ea5f4bd138 Update dnspython from 1.16.0 to 2.1.0 2021-03-15 13:55:06 +00:00
pyup-bot
aa246eb367 Update colorama from 0.4.3 to 0.4.4 2021-03-15 13:55:06 +00:00
pyup-bot
737be3028b Update botocore from 1.20.22 to 1.20.27 2021-03-15 13:55:06 +00:00
pyup-bot
dc93148907 Update boto3 from 1.17.22 to 1.17.27 2021-03-15 13:55:05 +00:00
pyup-bot
7e75b8e6c9 Update awscli from 1.19.22 to 1.19.27 2021-03-15 13:55:05 +00:00
pyup-bot
b9d2657de6 Update flake8-bugbear from 21.3.1 to 21.3.2 2021-03-15 13:55:04 +00:00
pyup-bot
7c16556c8c Update flake8 from 3.8.4 to 3.9.0 2021-03-15 13:55:04 +00:00
Leo Hemsted
dc02d036f1 Merge pull request #3827 from alphagov/invited-user-id
Invited user
2021-03-15 13:42:16 +00:00
karlchillmaid
919f00f829 Temporarily remove this line
Awaiting confirmation on the final wording, but I’d like to get this PR merged and the page updated asap.
2021-03-15 12:41:54 +00:00
Leo Hemsted
bf979128ab use new check api endpoints for validating invite tokens
added in https://github.com/alphagov/notifications-api/pull/3171
2021-03-15 12:22:00 +00:00
Leo Hemsted
45297eae43 store invited user ids in session
same as the invited org user ids in the previous commit
2021-03-15 12:21:58 +00:00
Chris Hill-Scott
c8943cec8b Report performance platform report
We used to upload this to performance platform to show the list of
services and organisations.

There is no longer a performance platform to upload this file to.
2021-03-15 10:21:36 +00:00
Chris Hill-Scott
8926f3fca6 Fix sort order on performance page
This commit makes both the tables sort in reverse chronological order.
2021-03-15 10:05:46 +00:00
Chris Hill-Scott
90ab5f5d71 Merge pull request #3835 from alphagov/fix-performance-page-services-without-org
Fix bug when live services have no organisation
2021-03-15 09:55:42 +00:00
Chris Hill-Scott
3ea9cba0bc Fix bug when live services have no organisation
The performance page expects all live services to have an organisation.
This should be true on production, but it isn’t always the case in
other environments.

When the organisation name is `None`, the frontend can’t sort the list
of organisations alphabetically and so raises an exception.
2021-03-15 09:42:06 +00:00