mirror of
https://github.com/GSA/notifications-api.git
synced 2026-08-19 14:08:47 -04:00
Add missing tests for old format areas
This was (sort of) missed in [1], but it hasn't caused a problem
because the code to create/update broadcasts will populate areas
in the old ("areas") and the new ("ids") formats anyway [2].
However, we're about to remove create/update support code, so we
need to have something in place to cope with old and new format
data until we backfill old broadcasts with the new format [3].
[1]: https://github.com/alphagov/notifications-api/pull/3312
[2]: https://github.com/alphagov/notifications-api/pull/3312/files#diff-6be38b59e387630a0c6b8fc60312b7ba53ba9f36c54594fa5690646f286dd2b9R141
[3]: 9667433b7e
This commit is contained in:
@@ -2339,7 +2339,7 @@ class BroadcastMessage(db.Model):
|
||||
# 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["ids"] = areas_2.pop("areas", areas_2.get("ids", []))
|
||||
|
||||
return {
|
||||
'id': str(self.id),
|
||||
@@ -2355,8 +2355,8 @@ class BroadcastMessage(db.Model):
|
||||
|
||||
# TEMPORARY: switch to this so we can repurpose "areas"
|
||||
'areas_2': areas_2,
|
||||
'areas': self.areas.get("areas", []),
|
||||
'simple_polygons': self.areas.get("simple_polygons", []),
|
||||
'areas': areas_2["ids"],
|
||||
'simple_polygons': areas_2["simple_polygons"],
|
||||
|
||||
'status': self.status,
|
||||
|
||||
|
||||
Reference in New Issue
Block a user