David McDonald
41b5b60cec
Update .gitignore
...
Make nice words
Co-authored-by: Chris Hill-Scott <me@quis.cc >
2020-08-14 10:22:39 +01:00
David McDonald
48fee71c2b
Reduce risk of commiting files with personal information in
2020-08-12 15:38:01 +01:00
Chris Hill-Scott
781847d32c
Merge pull request #3557 from alphagov/view-only-broadcast-page
...
Let users without `send_messages` view broadcasts
2020-08-12 15:16:39 +01:00
Chris Hill-Scott
0b206e3c0f
Merge pull request #3561 from alphagov/optimise-broadcast
...
Optimise broadcast area code for fast page loads
2020-08-12 11:32:13 +01:00
Chris Hill-Scott
8d74e9c08d
Store names and IDs of areas in memory
...
Now that the data needed to create a `BroadcastArea` is pretty
lightweight because it doesn’t include the GeoJSON we can go back to
putting it in memory when we start up the app, to make the pages load
really fast.
Rough estimate for the size of this dataset:
> 10,000 areas
> Average length of area name = 20 characters
> Average length of area id = 20 characters
> Size of one area in bytes = 20 + 20 = 40
> Size of dataset = 40 * 10,000 = 400,000 bytes = 400kb
2020-08-12 10:45:44 +01:00
Chris Hill-Scott
6c21a1732c
Refactor to assign directly
...
There’s no need for an intermediate variable here, and it’s confusing
having two properties containing the same data.
2020-08-12 10:45:14 +01:00
Chris Hill-Scott
f96c43f5bc
Store GeoJSON in a separate table
...
I think that even with good indexes, querying the area names from one
table is always going to be slow because there’s so much GeoJSON to scan
past.
This commit splits the data into two tables, one for the names and
grouping IDs and one for the blobs of GeoJSON. So for most pages the app
will never even be looking at the table where the GeoJSON is held.
I don’t know if this is a proper, normalised way of structuring the
data, but it does go brrr.
2020-08-12 10:43:01 +01:00
Chris Hill-Scott
e267e3d9f1
Refactor to use .query
...
All the other methods of this class call through to query, we can make
this code clearer by making `get_areas` do the same.
2020-08-12 10:42:28 +01:00
Chris Hill-Scott
adad27dadb
Lazy load feature from the SQLite database
...
Rather than querying all the features whenever we look up area(s) let’s
only get them when we need them.
The features are really big blobs of data to pass around, so there’s a
significant performance gain to be had from doing this.
2020-08-12 10:40:27 +01:00
Chris Hill-Scott
3f9e49603d
Merge pull request #3544 from alphagov/choose-electoral-ward
...
Let users select specific electoral wards in a local authority to broadcast to
2020-08-12 08:48:13 +01:00
Chris Hill-Scott
e47dbc0caa
Add tests to check permission-restricted broadcast pages
...
Some pages should only be shown to users who have permission to send or
approve broadcasts. This commit adds a test to ensure that this is true,
and that we don’t accidentally regress the checks for this permission.
2020-08-12 08:19:51 +01:00
Chris Hill-Scott
78c88530b5
Let users without send_messages view broadcasts
...
At the moment viewing a broadcast is limited to those users who have
the `send_messages` permission.
This doesn’t match how we describe the permissions on the team members
page
This commit makes it so that any team member can see a broadcast that’s
in any state other than `draft`.
2020-08-12 08:19:49 +01:00
Chris Hill-Scott
8570901731
Let users select electoral wards of local authorities
...
If a library has groups, we should show a link instead of selecting the
group directly.
Then we can give the user the choice of selecting the whole of that
group, or specific areas within the group.
For now the only libraries we have with groups are local authorities,
which group electoral wards.
2020-08-11 17:38:15 +01:00
David McDonald
38953d1c28
Merge pull request #3560 from alphagov/turn-redis-back-on
...
Turn redis back on
2020-08-11 15:40:26 +01:00
David McDonald
2aaca11f8b
Turn redis back on
2020-08-11 14:26:12 +01:00
David McDonald
32cc168c23
Merge pull request #3556 from alphagov/turn-redis-off
...
Turn off redis in all environments for rotation
2020-08-11 14:25:30 +01:00
Chris Hill-Scott
0ce64bcfde
Merge pull request #3553 from alphagov/move-broadcast-areas-into-admin
...
Move broadcast areas into admin
2020-08-11 13:25:21 +01:00
Chris Hill-Scott
ac470ff350
Merge pull request #3559 from alphagov/hidden-email-on-register
...
Put hidden email field on register from invite page
2020-08-11 13:18:22 +01:00
Toby Lorne
b0ff2d41c5
broadcast-areas: examples are deterministic
...
Signed-off-by: Toby Lorne <toby.lornewelch-richards@digital.cabinet-office.gov.uk >
2020-08-11 12:04:02 +01:00
Chris Hill-Scott
cf999b5d8e
Add inline comment explaining presence of field
2020-08-11 11:26:31 +01:00
Chris Hill-Scott
b0fc1cd271
Make test name more explicit
2020-08-11 11:22:59 +01:00
Toby Lorne
73e68c355b
broadcast-areas: include electoral wards
...
Signed-off-by: Toby Lorne <toby.lornewelch-richards@digital.cabinet-office.gov.uk >
2020-08-10 18:09:15 +01:00
Toby Lorne
6649d0ac70
broadcast-areas: use area ids in tests
...
Signed-off-by: Toby Lorne <toby.lornewelch-richards@digital.cabinet-office.gov.uk >
2020-08-10 18:09:15 +01:00
Chris Hill-Scott
834b0fc3d5
Put hidden email field on register from invite page
...
Password managers will try to guess what they should save as a username
by looking at the fields on the page where you set up your password.
When registering from an invite the email address (what we use as a
username) is predefined, and only shown on the page as text, not an
input.
This commit also adds a hidden input field for password managers to pick
up.
Adapted from: https://github.com/UKGovernmentBEIS/beis-opss-psd/blob/master/app/views/users/complete_registration.html.erb#L29-L36
2020-08-10 15:59:27 +01:00
Toby Lorne
8c3a8ecd04
broadcast-areas: view test does not assert order
...
the descriptions are liable to change esp for wards
Signed-off-by: Toby Lorne <toby.lornewelch-richards@digital.cabinet-office.gov.uk >
2020-08-10 13:04:03 +01:00
Toby Lorne
7a1b80e533
broadcast-areas: sort imports
...
Signed-off-by: Toby Lorne <toby.lornewelch-richards@digital.cabinet-office.gov.uk >
2020-08-10 12:50:22 +01:00
Toby Lorne
698e9816ec
models: use broadcast areas from admin package
...
Signed-off-by: Toby Lorne <toby.lornewelch-richards@digital.cabinet-office.gov.uk >
2020-08-10 12:50:22 +01:00
Toby Lorne
74b83ffa8b
broadcast-areas: vendor areas sqlite3 db
...
Signed-off-by: Toby Lorne <toby.lornewelch-richards@digital.cabinet-office.gov.uk >
2020-08-10 12:50:22 +01:00
Toby Lorne
488a5440cd
broadcast-areas: move broadcast areas into app
...
Signed-off-by: Toby Lorne <toby.lornewelch-richards@digital.cabinet-office.gov.uk >
2020-08-10 12:50:20 +01:00
Toby Lorne
3243faa9a9
broadcast-areas: import LAs to wards dataset groups
...
instead of our shonky groupings
Signed-off-by: Toby Lorne <toby.lornewelch-richards@digital.cabinet-office.gov.uk >
2020-08-10 12:50:18 +01:00
Toby Lorne
dde285ef03
broadcast-areas: buffer areas by a larger degree
...
Signed-off-by: Toby Lorne <toby.lornewelch-richards@digital.cabinet-office.gov.uk >
2020-08-10 12:50:18 +01:00
Toby Lorne
1301ae4bba
broadcast-areas: vendor sqlite3 areas
...
Signed-off-by: Toby Lorne <toby.lornewelch-richards@digital.cabinet-office.gov.uk >
2020-08-10 12:50:18 +01:00
Toby Lorne
4d97ad4399
broadcast-areas: big buffer & try simplify to 99
...
we want, if possible only 99 points per polygon
Signed-off-by: Toby Lorne <toby.lornewelch-richards@digital.cabinet-office.gov.uk >
2020-08-10 12:50:18 +01:00
Toby Lorne
8b8005966f
broadcast-areas: remove unused import
...
Signed-off-by: Toby Lorne <toby.lornewelch-richards@digital.cabinet-office.gov.uk >
2020-08-10 12:50:18 +01:00
Toby Lorne
0e3158da97
broadcast-areas: only store local authorities once
...
Signed-off-by: Toby Lorne <toby.lornewelch-richards@digital.cabinet-office.gov.uk >
2020-08-10 12:50:18 +01:00
Toby Lorne
b7e6b94e87
broadcast-areas: and in get_examples
...
Signed-off-by: Toby Lorne <toby.lornewelch-richards@digital.cabinet-office.gov.uk >
2020-08-10 12:50:18 +01:00
Toby Lorne
b98cf6616c
broadcast-areas: remove unused imports
...
Signed-off-by: Toby Lorne <toby.lornewelch-richards@digital.cabinet-office.gov.uk >
2020-08-10 12:50:18 +01:00
Toby Lorne
01ffc815e7
broadcast-areas: do not use group table
...
do not need it
Signed-off-by: Toby Lorne <toby.lornewelch-richards@digital.cabinet-office.gov.uk >
2020-08-10 12:50:18 +01:00
Toby Lorne
17af32978f
broadcast-areas: use cached_property not a hack
...
Signed-off-by: Toby Lorne <toby.lornewelch-richards@digital.cabinet-office.gov.uk >
2020-08-10 12:50:18 +01:00
Toby Lorne
8ecbfe5996
broadcast-areas: package works with groups
...
Signed-off-by: Toby Lorne <toby.lornewelch-richards@digital.cabinet-office.gov.uk >
2020-08-10 12:50:18 +01:00
Toby Lorne
58915ac968
broadcast-areas: plot script works with groups
...
Signed-off-by: Toby Lorne <toby.lornewelch-richards@digital.cabinet-office.gov.uk >
2020-08-10 12:50:18 +01:00
Toby Lorne
7f4dd0acb5
broadcast-areas: create broadcast areas in groups
...
Signed-off-by: Toby Lorne <toby.lornewelch-richards@digital.cabinet-office.gov.uk >
2020-08-10 12:50:18 +01:00
Toby Lorne
65bef7bdc3
broadcast-areas: only parse geojson once
...
Signed-off-by: Toby Lorne <toby.lornewelch-richards@digital.cabinet-office.gov.uk >
2020-08-10 12:50:18 +01:00
Toby Lorne
35a881d950
broadcast-areas: only load geojson when needed
...
Signed-off-by: Toby Lorne <toby.lornewelch-richards@digital.cabinet-office.gov.uk >
2020-08-10 12:50:18 +01:00
Toby Lorne
0ae8ef650f
broadcast-areas: apply buffer to areas
...
Signed-off-by: Toby Lorne <toby.lornewelch-richards@digital.cabinet-office.gov.uk >
2020-08-10 12:50:18 +01:00
Toby Lorne
22cf63a440
broadcast-areas: simple feature plots show points
...
Signed-off-by: Toby Lorne <toby.lornewelch-richards@digital.cabinet-office.gov.uk >
2020-08-10 12:50:18 +01:00
Toby Lorne
e21d424f97
broadcast-areas: (dev) add visualisation tool
...
Signed-off-by: Toby Lorne <toby.lornewelch-richards@digital.cabinet-office.gov.uk >
2020-08-10 12:50:18 +01:00
Toby Lorne
6d5593dc32
broadcast-areas: include simple feature
...
simple feature is a feature where there are no islands and all polygons
are capped to 125 points
Signed-off-by: Toby Lorne <toby.lornewelch-richards@digital.cabinet-office.gov.uk >
2020-08-10 12:50:18 +01:00
Toby Lorne
7074655b84
broadcast-areas: BroadcastAreaLibraries uses sql
...
sqlite
Signed-off-by: Toby Lorne <toby.lornewelch-richards@digital.cabinet-office.gov.uk >
2020-08-10 12:50:18 +01:00
Toby Lorne
9a9bf3c270
broadcast-areas: refactor to use repo.py
...
share functionality between repo used by create script and by package
Signed-off-by: Toby Lorne <toby.lornewelch-richards@digital.cabinet-office.gov.uk >
2020-08-10 12:50:18 +01:00