Skip to content

Commit

Permalink
move out fields split
Browse files Browse the repository at this point in the history
  • Loading branch information
nazarfil committed Dec 31, 2024
1 parent 82d6cab commit 09f728b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion openhexa/toolbox/dhis2/dhis2.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,9 @@ def organisation_unit_levels(self, fields: str = "id,name,level") -> List[dict]:
params = {"fields": fields}
r = self.client.api.get("filledOrganisationUnitLevels", params=params)
levels = []
fields_list = fields.split(",")
for level in r:
levels.append({k: v for k, v in level.items() if k in fields.split(",")})
levels.append({k: v for k, v in level.items() if k in fields_list})
return levels

def organisation_units(self, fields: str = "id,name,level,path,geometry", filter: str = None) -> List[dict]:
Expand Down

0 comments on commit 09f728b

Please sign in to comment.