This repository has been archived by the owner on Jun 12, 2024. It is now read-only.
forked from kobotoolbox/enketo-express
-
Notifications
You must be signed in to change notification settings - Fork 23
Error uploading calculate item with default but no calculation #416
Milestone
Comments
Less important, but still one I'd like to get changed: if the calculate item's default is static (for example, 5) and it does not have a calculation, a "Missing calculation." error occurs. This still requires a dummy calculation to get around, but at least it identifies the error and row number it came from. |
Hey Paul, The zip file seems to be empty. |
@MartijnR - Sorry about that, I uploaded a new copy of the file that should work. |
These use cases (and all uses for type=calculate) really call for type=hidden. I wonder if this should be promoted more (and perhaps also in pyxform warning output)
|
bug: XLSForm/pyxform#507 discussion about type=calculate confusions: XLSForm/pyxform#508 |
Looks good in testing. |
MartijnR
added a commit
that referenced
this issue
May 18, 2022
…than 1 form with the same title exist in the local database, closes #416
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
This form - demo-vitals-grid-v32-calculate test.zip - fails with a lengthy error from Pyxform when uploaded:
Traceback (most recent call last): File "/opt/transformer/XLSForm-repo/src/pyxform/pyxform/xls2xform.py", line 195, in main_cli() File "/opt/transformer/XLSForm-repo/src/pyxform/pyxform/xls2xform.py", line 177, in main_cli enketo=args.enketo_validate, File "/opt/transformer/XLSForm-repo/src/pyxform/pyxform/xls2xform.py", line 49, in xls2xform_convert enketo=enketo, File "/opt/transformer/XLSForm-repo/src/pyxform/pyxform/survey.py", line 1055, in print_xform_to_file raise error File "/opt/transformer/XLSForm-repo/src/pyxform/pyxform/survey.py", line 1051, in print_xform_to_file file_obj.write(self._to_ugly_xml()) File "/opt/transformer/XLSForm-repo/src/pyxform/pyxform/survey.py", line 838, in _to_ugly_xml return '' + self.xml().toxml() File "/opt/transformer/XLSForm-repo/src/pyxform/pyxform/survey.py", line 243, in xml node("h:head", node("h:title", self.title), self.xml_model()), File "/opt/transformer/XLSForm-repo/src/pyxform/pyxform/survey.py", line 546, in xml_model model_children += self.xml_bindings() File "/opt/transformer/XLSForm-repo/src/pyxform/pyxform/survey_element.py", line 479, in xml_bindings dynamic_default = e.get_setvalue_node_for_dynamic_default() File "/opt/transformer/XLSForm-repo/src/pyxform/pyxform/survey_element.py", line 369, in get_setvalue_node_for_dynamic_default default_with_xpath_paths = self.get_root().insert_xpaths(self.default, self) File "/opt/transformer/XLSForm-repo/src/pyxform/pyxform/survey.py", line 996, in insert_xpaths return re.sub(BRACKETED_TAG_REGEX, _var_repl_function, unicode(text)) File "/usr/lib64/python3.6/re.py", line 191, in sub return _compile(pattern, flags).sub(repl, string, count) File "/opt/transformer/XLSForm-repo/src/pyxform/pyxform/survey.py", line 993, in _var_repl_function matchobj, context, use_current, reference_parent File "/opt/transformer/XLSForm-repo/src/pyxform/pyxform/survey.py", line 976, in _var_repl_function if _is_return_relative_path(): File "/opt/transformer/XLSForm-repo/src/pyxform/pyxform/survey.py", line 960, in _is_return_relative_path and "indexed-repeat" in context["bind"]["calculate"] KeyError: 'calculate'
If I add a dummy calculation to the calculate item ${cohort} (such as once(.)), this error does not occur. Note that other scenarios with a default defined with no calculation do not cause this issue. The dummy calculation can be removed from calculate item ${rndm} without causing this error.
Given the message at the end, is this related to #398 / XLSForm/pyxform#484 ?
The text was updated successfully, but these errors were encountered: