Skip to content

Commit

Permalink
Merge pull request #3679 from unicef/hotfix-results-structure-sync
Browse files Browse the repository at this point in the history
[HOTPATCH] update synchronizer
  • Loading branch information
robertavram authored Jun 4, 2024
2 parents 2404840 + 0391798 commit c4fd264
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 33 deletions.
2 changes: 1 addition & 1 deletion src/etools/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
VERSION = __version__ = '11.2.1'
VERSION = __version__ = '11.2.3'
NAME = 'eTools'
27 changes: 13 additions & 14 deletions src/etools/applications/reports/synchronizers.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,19 +185,18 @@ class ProgrammeSynchronizer(VisionDataTenantSynchronizer):
"COUNTRY_PROGRAMME_WBS",
"CP_START_DATE",
"CP_END_DATE",
"OUTCOME_AREA_CODE",
"OUTCOME_AREA_NAME",
"OUTCOME_AREA_NAME_LONG",
"GOAL_AREA_CODE",
"GOAL_AREA_NAME",
"OUTCOME_WBS",
"OUTCOME_DESCRIPTION",
"OUTCOME_NAME",
"OUTCOME_START_DATE",
"OUTCOME_END_DATE",
"OUTPUT_WBS",
"OUTPUT_DESCRIPTION",
"OUTPUT_NAME",
"OUTPUT_START_DATE",
"OUTPUT_END_DATE",
"ACTIVITY_WBS",
"ACTIVITY_DESCRIPTION",
"ACTIVITY_NAME",
"ACTIVITY_START_DATE",
"ACTIVITY_END_DATE",
"SIC_CODE",
Expand All @@ -211,8 +210,8 @@ class ProgrammeSynchronizer(VisionDataTenantSynchronizer):
"HUMANITARIAN_TAG",
"HUMANITARIAN_MARKER_CODE",
"HUMANITARIAN_MARKER_NAME",
"PROGRAMME_AREA_CODE",
"PROGRAMME_AREA_NAME",
"RESULT_AREA_CODE",
"RESULT_AREA_NAME",
)
DATES = (
"CP_START_DATE",
Expand All @@ -231,25 +230,25 @@ class ProgrammeSynchronizer(VisionDataTenantSynchronizer):
("CP_END_DATE", "to_date")
)
OUTCOME_MAP = (
("OUTCOME_AREA_CODE", "code"),
("GOAL_AREA_CODE", "code"),
("OUTCOME_WBS", "wbs"),
("OUTCOME_DESCRIPTION", "name"),
("OUTCOME_NAME", "name"),
("OUTCOME_START_DATE", "from_date"),
("OUTCOME_END_DATE", "to_date"),
)
OUTPUT_MAP = (
("OUTPUT_WBS", "wbs"),
("OUTPUT_DESCRIPTION", "name"),
("OUTPUT_NAME", "name"),
("OUTPUT_START_DATE", "from_date"),
("OUTPUT_END_DATE", "to_date"),
("HUMANITARIAN_MARKER_CODE", "humanitarian_marker_code"),
("HUMANITARIAN_MARKER_NAME", "humanitarian_marker_name"),
("PROGRAMME_AREA_CODE", "programme_area_code"),
("PROGRAMME_AREA_NAME", "programme_area_name"),
("RESULT_AREA_CODE", "programme_area_code"),
("RESULT_AREA_NAME", "programme_area_name"),
)
ACTIVITY_MAP = (
("ACTIVITY_WBS", "wbs"),
("ACTIVITY_DESCRIPTION", "name"),
("ACTIVITY_NAME", "name"),
("ACTIVITY_START_DATE", "from_date"),
("ACTIVITY_END_DATE", "to_date"),
("SIC_CODE", "sic_code"),
Expand Down
35 changes: 17 additions & 18 deletions src/etools/applications/reports/tests/test_synchronizers.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,19 +357,18 @@ def setUp(self):
"COUNTRY_PROGRAMME_WBS": "",
"CP_START_DATE": "",
"CP_END_DATE": "",
"OUTCOME_AREA_CODE": "",
"OUTCOME_AREA_NAME": "",
"OUTCOME_AREA_NAME_LONG": "",
"GOAL_AREA_CODE": "",
"GOAL_AREA_NAME": "",
"OUTCOME_WBS": "",
"OUTCOME_DESCRIPTION": "",
"OUTCOME_NAME": "",
"OUTCOME_START_DATE": "",
"OUTCOME_END_DATE": "",
"OUTPUT_WBS": "",
"OUTPUT_DESCRIPTION": "",
"OUTPUT_NAME": "",
"OUTPUT_START_DATE": "",
"OUTPUT_END_DATE": "",
"ACTIVITY_WBS": "",
"ACTIVITY_DESCRIPTION": "",
"ACTIVITY_NAME": "",
"ACTIVITY_START_DATE": "",
"ACTIVITY_END_DATE": "",
"SIC_CODE": "",
Expand All @@ -383,8 +382,8 @@ def setUp(self):
"HUMANITARIAN_TAG": "",
"HUMANITARIAN_MARKER_CODE": "",
"HUMANITARIAN_MARKER_NAME": "",
"PROGRAMME_AREA_CODE": "",
"PROGRAMME_AREA_NAME": "",
"RESULT_AREA_CODE": "",
"RESULT_AREA_NAME": "",
}
self.adapter = ProgrammeSynchronizer(business_area_code=self.country.business_area_code)

Expand Down Expand Up @@ -442,8 +441,8 @@ def test_clean_records_cps(self):
def test_clean_records_outcomes(self):
"""Need all outcome map values set, otherwise ignore"""
self.data["OUTCOME_WBS"] = "OC_WBS"
self.data["OUTCOME_AREA_CODE"] = "OC_CODE"
self.data["OUTCOME_DESCRIPTION"] = "OC_NAME"
self.data["GOAL_AREA_CODE"] = "OC_CODE"
self.data["OUTCOME_NAME"] = "OC_NAME"
self.data["OUTCOME_START_DATE"] = datetime.date.today()
self.data["OUTCOME_END_DATE"] = datetime.date.today()
records = [self.data]
Expand All @@ -469,13 +468,13 @@ def test_clean_records_outcomes(self):
def test_clean_records_outputs(self):
"""Need all output map values set, otherwise ignore"""
self.data["OUTPUT_WBS"] = "OP_WBS"
self.data["OUTPUT_DESCRIPTION"] = "OP_NAME"
self.data["OUTPUT_NAME"] = "OP_NAME"
self.data["OUTPUT_START_DATE"] = "OP_START"
self.data["OUTPUT_END_DATE"] = "OP_END"
self.data["HUMANITARIAN_MARKER_CODE"] = "HUMANITARIAN_MARKER_CODE"
self.data["HUMANITARIAN_MARKER_NAME"] = "HUMANITARIAN_MARKER_NAME"
self.data["PROGRAMME_AREA_CODE"] = "PROGRAMME_AREA_CODE"
self.data["PROGRAMME_AREA_NAME"] = "PROGRAMME_AREA_NAME"
self.data["RESULT_AREA_CODE"] = "RESULT_AREA_CODE"
self.data["RESULT_AREA_NAME"] = "RESULT_AREA_NAME"
records = [self.data]
result = self.adapter._clean_records(records)
self.assertEqual(result, {
Expand All @@ -492,8 +491,8 @@ def test_clean_records_outputs(self):
"from_date": "OP_START",
'humanitarian_marker_code': 'HUMANITARIAN_MARKER_CODE',
'humanitarian_marker_name': 'HUMANITARIAN_MARKER_NAME',
'programme_area_code': 'PROGRAMME_AREA_CODE',
'programme_area_name': 'PROGRAMME_AREA_NAME',
'programme_area_code': 'RESULT_AREA_CODE',
'programme_area_name': 'RESULT_AREA_NAME',
"to_date": "OP_END",
}},
"activities": {}
Expand All @@ -502,7 +501,7 @@ def test_clean_records_outputs(self):
def test_clean_records_activities(self):
"""Need all activity map values set, otherwise ignore"""
self.data["ACTIVITY_WBS"] = "A_WBS"
self.data["ACTIVITY_DESCRIPTION"] = "A_NAME"
self.data["ACTIVITY_NAME"] = "A_NAME"
self.data["ACTIVITY_START_DATE"] = "A_START"
self.data["ACTIVITY_END_DATE"] = "A_END"
self.data["SIC_CODE"] = "S_CODE"
Expand Down Expand Up @@ -542,8 +541,8 @@ def test_convert_records(self):
self.data["CP_START_DATE"] = "14-May-00"
self.data["CP_END_DATE"] = "26-May-13"
self.data["OUTCOME_WBS"] = "OC_WBS"
self.data["OUTCOME_AREA_CODE"] = "OC_CODE"
self.data["OUTCOME_DESCRIPTION"] = "OC_NAME"
self.data["GOAL_AREA_CODE"] = "OC_CODE"
self.data["OUTCOME_NAME"] = "OC_NAME"
self.data["OUTCOME_START_DATE"] = "20-Feb-13"
self.data["OUTCOME_END_DATE"] = "20-Feb-{}".format(str(datetime.date.today().year)[-2:])
self.data["OUTPUT_START_DATE"] = "29-Oct-44"
Expand Down

0 comments on commit c4fd264

Please sign in to comment.