XLSForm / pyxform

A Python package to create XForms for ODK Collect.
BSD 2-Clause "Simplified" License
80 stars 136 forks source link

Prevent untyped calculates from being used as calculation triggers #489

Closed lognaturel closed 3 years ago

lognaturel commented 3 years ago

Closes #486

@gushil I took this on to hopefully give you a little extra time for #485. I think you're best positioned to see if there's a way to make it a little easier to work with. I should hopefully also have a bit of time for it tomorrow.

Why is this the best possible solution? Were any other approaches considered?

I didn't consider any alternatives. This extends the existing logic to treat any question with a calculate type as ineligible to be a calculation trigger.

What are the regression risks?

The only change is to the logic that for a given question suppresses body tags and produces an error if it's used as a trigger. The worst case would be if this adds cases that are actually suppose to lead to body elements

Does this change require updates to documentation? If so, please file an issue here and include the link below.

No.

Before submitting this PR, please make sure you have:

codecov-io commented 3 years ago

Codecov Report

Merging #489 (81e293c) into master (a584303) will not change coverage. The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #489   +/-   ##
=======================================
  Coverage   83.67%   83.67%           
=======================================
  Files          25       25           
  Lines        3651     3651           
  Branches      849      849           
=======================================
  Hits         3055     3055           
  Misses        452      452           
  Partials      144      144           
Impacted Files Coverage Δ
pyxform/question.py 93.30% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update a584303...81e293c. Read the comment docs.

gushil commented 3 years ago

Thanks @lognaturel