mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-07-09 19:04:33 -04:00
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
This commit is contained in:
@@ -105,14 +105,11 @@ class BroadcastAreaLibrary(SerialisedModelCollection, SortableMixin, GetItemById
|
||||
self.id = id
|
||||
self.name = name
|
||||
self.is_group = bool(is_group)
|
||||
self.items = BroadcastAreasRepository().get_all_areas_for_library(self.id)
|
||||
|
||||
def get_examples(self):
|
||||
return BroadcastAreasRepository().get_library_description(self.id)
|
||||
|
||||
@property
|
||||
def items(self):
|
||||
return BroadcastAreasRepository().get_all_areas_for_library(self.id)
|
||||
|
||||
|
||||
class BroadcastAreaLibraries(SerialisedModelCollection, GetItemByIdMixin):
|
||||
|
||||
|
||||
Reference in New Issue
Block a user