Skip to content

Commit

Permalink
Merge pull request #220 from Sujanadh/minor-fixes
Browse files Browse the repository at this point in the history
refactor: return full submissions detail
  • Loading branch information
nrjadkry committed Jan 18, 2024
2 parents 741e4a4 + 0fe54ab commit b461a94
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
17 changes: 5 additions & 12 deletions osm_fieldwork/OdkCentral.py
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,7 @@ def listSubmissions(self, projectId: int, xform: str, filters: dict = None):
result = self.session.get(url, auth=self.auth, params=filters, verify=self.verify)
if result.ok:
self.submissions = result.json()
return self.submissions["value"]
return self.submissions
else:
return list()

Expand Down Expand Up @@ -961,13 +961,8 @@ def publishForm(
log.info(f"Published {xform} on Central.")
return result.status_code


def form_fields(self,
projectId:int,
xform:str):

"""
Retrieves the form fields for a xform from odk central.
def form_fields(self, projectId: int, xform: str):
"""Retrieves the form fields for a xform from odk central.
Args:
projectId (int): The ID of the project on ODK Central
Expand All @@ -977,17 +972,15 @@ def form_fields(self,
dict: A json object containing the form fields.
"""

if xform.find("_") > 0:
xid = xform.split('_')[2]
xid = xform.split("_")[2]
else:
xid = xform

url = f"{self.base}projects/{projectId}/forms/{xid}/fields?odata=true"
result=self.session.get(url, auth=self.auth)
result = self.session.get(url, auth=self.auth)
return result.json()


def dump(self):
"""Dump internal data structures, for debugging purposes only."""
# super().dump()
Expand Down
2 changes: 1 addition & 1 deletion osm_fieldwork/filter_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ def cleanData(
continue
log.warning(f"Tag {key} not in the data model!")
continue
if 'title' not in properties:
if "title" not in properties:
properties["label"] = properties["id"]
properties["title"] = properties["id"]
newfeature = Feature(geometry=feature["geometry"], properties=properties)
Expand Down

0 comments on commit b461a94

Please sign in to comment.