Skip to content

Commit

Permalink
Merge pull request #2096 from IFRCGo/fix/molnix-closes
Browse files Browse the repository at this point in the history
set closes even when set later on Molnix, set archived status correctly
  • Loading branch information
szabozoltan69 authored Apr 11, 2024
2 parents 68f56be + cdfb45d commit a0618a3
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions api/management/commands/sync_molnix.py
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,7 @@ def sync_open_positions(molnix_positions, molnix_api, countries):
successful_updates = 0

for position in molnix_positions:
logger.warning('× ' + str(position["id"]))
if skip_this(position["tags"]):
warning = "Position id %d skipped due to No-GO" % position["id"]
logger.warning(warning)
Expand Down Expand Up @@ -495,6 +496,11 @@ def sync_open_positions(molnix_positions, molnix_api, countries):
warnings.append("Position id %d not found in Molnix API" % alert.molnix_id)
if position and position["status"] == "unfilled":
alert.molnix_status = position["status"]
if position and position['closes']:
alert.closes = get_datetime(position["closes"])
if position and position['status'] == 'archived':
alert.molnix_status = position['status']
alert.is_active = False
else:
alert.is_active = False
alert.save()
Expand Down

0 comments on commit a0618a3

Please sign in to comment.