mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-05 03:38:26 -04:00
broadcast-areas: only load geojson when needed
Signed-off-by: Toby Lorne <toby.lornewelch-richards@digital.cabinet-office.gov.uk>
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import geojson
|
||||
import itertools
|
||||
|
||||
from notifications_utils.serialised_model import SerialisedModelCollection
|
||||
@@ -39,8 +40,8 @@ class BroadcastArea(IdentifiableMixin):
|
||||
|
||||
self.id = id
|
||||
self.name = name
|
||||
self.feature = feature
|
||||
self.simple_feature = simple_feature
|
||||
self._feature = feature
|
||||
self._simple_feature = simple_feature
|
||||
|
||||
for coordinates in self.polygons:
|
||||
if coordinates[0] != coordinates[-1]:
|
||||
@@ -91,6 +92,14 @@ class BroadcastArea(IdentifiableMixin):
|
||||
def simple_unenclosed_polygons(self):
|
||||
return self._unenclosed_polygons(self.simple_feature)
|
||||
|
||||
@property
|
||||
def feature(self):
|
||||
return geojson.loads(self._feature)
|
||||
|
||||
@property
|
||||
def simple_feature(self):
|
||||
return geojson.loads(self._simple_feature)
|
||||
|
||||
|
||||
class BroadcastAreaLibrary(SerialisedModelCollection, IdentifiableMixin, IdFromNameMixin, GetItemByIdMixin):
|
||||
|
||||
|
||||
Reference in New Issue
Block a user