Skip to content

Commit

Permalink
Use body type for selects when converting XForm to JSON
Browse files Browse the repository at this point in the history
  • Loading branch information
lognaturel committed Jan 27, 2020
1 parent 3723bb6 commit e19c841
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pyxform/xform2json.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,10 +408,12 @@ def _get_question_from_object(self, obj, type=None):
if "autoplay" in obj:
question["control"].update({"autoplay": obj["autoplay"]})
question_params = self._get_question_params_from_bindings(ref)

if isinstance(question_params, dict):
for k, v in iter(question_params.items()):
question[k] = v
# has to come after the above block

# Some values set from bindings are incorrect or incomplete. Correct them now.
if "mediatype" in obj:
question["type"] = obj["mediatype"].replace("/*", "")
if "item" in obj:
Expand Down Expand Up @@ -450,6 +452,8 @@ def _get_question_from_object(self, obj, type=None):
question["type"] = question_type
if type == "trigger":
question["type"] = "acknowledge"
if type in ["select1", "select"]: # Select bind type is 'string' https://github.com/XLSForm/pyxform/issues/168
question["type"] = self.QUESTION_TYPES[type]
if question_type == "geopoint" and "hint" in question:
del question["hint"]
if "type" not in question and type:
Expand Down

0 comments on commit e19c841

Please sign in to comment.