mirror of
https://github.com/GSA/notifications-api.git
synced 2026-07-23 17:39:40 -04:00
Switch "areas" field to "areas_2" format
The Admin app is now temporarily using the "areas_2" field while we migrate "areas" to the new format [1]. [1]: https://github.com/alphagov/notifications-admin/pull/4004
This commit is contained in:
@@ -2337,9 +2337,9 @@ class BroadcastMessage(db.Model):
|
||||
|
||||
def serialize(self):
|
||||
# TEMPORARY: while we repurpose "areas"
|
||||
areas_2 = dict(self.areas)
|
||||
areas_2["simple_polygons"] = areas_2.get("simple_polygons", [])
|
||||
areas_2["ids"] = areas_2.pop("areas", areas_2.get("ids", []))
|
||||
areas = dict(self.areas)
|
||||
areas["simple_polygons"] = areas.get("simple_polygons", [])
|
||||
areas["ids"] = areas.pop("areas", areas.get("ids", []))
|
||||
|
||||
return {
|
||||
'id': str(self.id),
|
||||
@@ -2354,9 +2354,8 @@ class BroadcastMessage(db.Model):
|
||||
'content': self.content,
|
||||
|
||||
# TEMPORARY: switch to this so we can repurpose "areas"
|
||||
'areas_2': areas_2,
|
||||
'areas': areas_2["ids"],
|
||||
'simple_polygons': areas_2["simple_polygons"],
|
||||
'areas_2': areas,
|
||||
'areas': areas,
|
||||
|
||||
'status': self.status,
|
||||
|
||||
|
||||
Reference in New Issue
Block a user