Skip to content

Commit

Permalink
Fix for process_programme_document periodic task on target and baseline
Browse files Browse the repository at this point in the history
  • Loading branch information
emaciupe committed Jul 22, 2022
1 parent 9542387 commit 2152aa8
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion django_api/etools_prp/apps/unicef/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ def process_programme_documents(fast=False, area=False):
},
)

if item['status'] not in ("draft, signed",):
if item['status'] not in ("draft", "signed",):
# Mark all LLO/reportables assigned to this PD as inactive
llos = LowerLevelOutput.objects.filter(cp_output__programme_document=pd)
llos.update(active=False)
Expand Down Expand Up @@ -487,6 +487,13 @@ def process_programme_documents(fast=False, area=False):
i['object_id'] = llo.id
i['start_date'] = item['start_date']
i['end_date'] = item['end_date']
# convert numbers as strings into numeric "1500" -> 1500
for k, v in i['target'].items():
if type(v) == str:
i['target'][k] = float(i['target'][k]) if ',' in i['target'][k] or '.' in i['target'][k] else int(i['target'][k])
for k, v in i['baseline'].items():
if type(v) == str:
i['baseline'][k] = float(i['baseline'][k]) if ',' in i['baseline'][k] or '.' in i['baseline'][k] else int(i['baseline'][k])

reportable = process_model(
Reportable,
Expand Down

0 comments on commit 2152aa8

Please sign in to comment.