diff --git a/akvo/iati/checks/fields/status.py b/akvo/iati/checks/fields/status.py index cf1716ded8..b768905efb 100644 --- a/akvo/iati/checks/fields/status.py +++ b/akvo/iati/checks/fields/status.py @@ -12,7 +12,7 @@ def status(project): :param project: Project object :return: All checks passed boolean, [Check results] """ - if project.status: + if project.iati_status: return True, [(u'success', u'has status')] else: diff --git a/akvo/iati/exports/elements/activity_status.py b/akvo/iati/exports/elements/activity_status.py index f4f51ced84..71b05a7dac 100644 --- a/akvo/iati/exports/elements/activity_status.py +++ b/akvo/iati/exports/elements/activity_status.py @@ -7,7 +7,7 @@ from lxml import etree STATUS_TO_CODE = { - 'N': '6', + 'N': '0', 'H': '1', 'A': '2', 'C': '3', @@ -23,9 +23,9 @@ def activity_status(project): :param project: Project object :return: A list of Etree elements """ - if project.status in STATUS_TO_CODE.keys(): + if project.iati_status: element = etree.Element("activity-status") - element.attrib['code'] = STATUS_TO_CODE[project.status] + element.attrib['code'] = project.iati_status return [element] return [] diff --git a/akvo/iati/imports/mappers/defaults.py b/akvo/iati/imports/mappers/defaults.py index e602a74ea5..bceb3592e5 100644 --- a/akvo/iati/imports/mappers/defaults.py +++ b/akvo/iati/imports/mappers/defaults.py @@ -181,11 +181,9 @@ def do_import(self): status = self.get_child_elem_attrib( self.parent_elem, 'activity-status', 'code', 'status') - if status in CODE_TO_STATUS.keys(): - status = CODE_TO_STATUS[status] - else: + if not status: self.add_log('activity-status@code', 'status', 'invalid status code') - status = Project.STATUS_NONE + status = 0 return self.update_project_field('status', status)