Skip to content

Commit

Permalink
Remove is_active, is_stood_down from SurgeAlert model.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rup-Narayan-Rajbanshi committed Aug 9, 2024
1 parent 99d2c5e commit f0f44bc
Show file tree
Hide file tree
Showing 8 changed files with 945 additions and 713 deletions.
4 changes: 2 additions & 2 deletions api/management/commands/sync_molnix.py
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ def sync_open_positions(molnix_positions, molnix_api, countries):
successful_updates += 1

# Find existing active alerts that are not in the current list from Molnix
existing_alerts = SurgeAlert.objects.filter(SurgeAlertStatus.OPEN).exclude(molnix_id__isnull=True)
existing_alerts = SurgeAlert.objects.filter(molnix_status=SurgeAlertStatus.OPEN).exclude(molnix_id__isnull=True)
existing_alert_ids = [e.molnix_id for e in existing_alerts]
inactive_alerts = list(set(existing_alert_ids) - set(molnix_ids))

Expand All @@ -502,7 +502,7 @@ def sync_open_positions(molnix_positions, molnix_api, countries):
position = molnix_api.get_position(alert.molnix_id)
if not position:
warnings.append("Position id %d not found in Molnix API" % alert.molnix_id)
if position and position["status"].lower():
if position and position["status"]:
alert.molnix_status = SurgeAlert.parse_molnix_status(position["status"])
if position and position["closes"]:
alert.closes = get_datetime(position["closes"])
Expand Down
Loading

0 comments on commit f0f44bc

Please sign in to comment.