Skip to content

Commit

Permalink
Updated lines 1404-1405
Browse files Browse the repository at this point in the history
  • Loading branch information
ertush committed Aug 2, 2024
1 parent 4b9c50d commit 2473d66
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions facilities/models/facility_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,9 @@ def get_org_unit_id(self, code):
"paging": "false"
}
)
print("Get Org Unit ID Response", r.text, str(code))
raise ValidationError("[DEBUG] Repsonse {}".format(r.text))

if len(r.json()["organisationUnits"]) is 1 and "id" in r.json()["organisationUnits"][0]:
raise ValidationError("[DEBUG] Repsonse {}".format(r.text))
return [r.json()["organisationUnits"][0]["id"], 'retrieved']
else:
r_generate_orgunit_uid = requests.get(
Expand Down Expand Up @@ -205,7 +204,7 @@ def push_facility_to_dhis2(self, new_facility_payload, new_facility):
raise ValidationError(
{
"Error!": [
"[DEBUG] new_facility: {}; [DEBUG] new_facility_payload: {}; [DEBUG] isRetrived: {}".format(new_facility, new_facility_payload, isRetrived),
"[DEBUG] new_facility: {}; [DEBUG] new_facility_payload: {}; [DEBUG] isRetrived: {}".format(new_facility, new_facility_payload),
"An error occured while creating the facility in KHIS Aggregate. This is may be caused by the "
"existance of an organisation unit with as similar name as to the one you are creating. KHIS Error: {}".format(r.text)
]
Expand Down Expand Up @@ -1380,7 +1379,6 @@ def push_new_facility(self, code=None):
facility_code = str(self.code)
new_facility_payload = {
"id": dhis2_org_unit_id[0],
"access": dhis2_org_unit_id[1],
"code": facility_code,
"name": str(self.name),
"shortName": str(self.name[:49]),
Expand Down

0 comments on commit 2473d66

Please sign in to comment.