Skip to content

Commit 8ad4c8b

Browse files
committed
Fix synx_molnix position_id issue
1 parent b03b6f1 commit 8ad4c8b

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

api/management/commands/sync_molnix.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ def prt(message_text, molnix_id, position_or_event_id=0, organization=""):
5858
warning_type = 4
5959
elif message_text == "Deployment did not find SurgeAlert":
6060
warning_type = 5
61+
elif message_text == "Deployment did not find SurgeAlert in lack of position_id":
62+
warning_type = 5
6163
elif message_text == "NS Name not found for Deployment with secondment_incoming":
6264
warning_type = 6
6365
elif message_text == "Did not import Deployment. Invalid Event":
@@ -320,7 +322,13 @@ def sync_deployments(molnix_deployments, molnix_api, countries):
320322

321323
surge_alert = None
322324
try:
323-
if md["position_id"]:
325+
if "position_id" not in md:
326+
warning = "%d deployment did not find SurgeAlert in lack of Molnix position_id" % md["id"]
327+
logger.warning(warning)
328+
warnings.append(warning)
329+
prt("Deployment did not find SurgeAlert in lack of position_id", md["id"])
330+
continue
331+
elif md["position_id"]:
324332
surge_alert = SurgeAlert.objects.get(molnix_id=md["position_id"])
325333
except Exception:
326334
warning = "%d deployment did not find SurgeAlert with Molnix position_id %d." % (md["id"], md["position_id"])

0 commit comments

Comments
 (0)