Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Triggers referring to hidden question will produce an error. #457

Merged
merged 1 commit into from
Jul 23, 2020
Merged

Triggers referring to hidden question will produce an error. #457

merged 1 commit into from
Jul 23, 2020

Conversation

gushil
Copy link
Contributor

@gushil gushil commented Jul 13, 2020

Closes #
#452

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

The simplest one.

What are the regression risks?

None.

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

None.

Before submitting this PR, please make sure you have:

  • included test cases for core behavior and edge cases in tests_v1
  • run nosetests and verified all tests pass
  • run black pyxform to format code
  • verified that any code or assets from external sources are properly credited in comments

@codecov-commenter
Copy link

codecov-commenter commented Jul 13, 2020

Codecov Report

Merging #457 into master will decrease coverage by 0.00%.
The diff coverage is 80.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #457      +/-   ##
==========================================
- Coverage   83.11%   83.11%   -0.01%     
==========================================
  Files          25       25              
  Lines        3595     3600       +5     
  Branches      833      835       +2     
==========================================
+ Hits         2988     2992       +4     
  Misses        460      460              
- Partials      147      148       +1     
Impacted Files Coverage Δ
pyxform/question.py 92.85% <80.00%> (-0.32%) ⬇️

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 b0bd9d4...77d44e9. Read the comment docs.

@MartijnR
Copy link
Contributor

Thanks Agus! I have not been able to break this.

@MartijnR MartijnR requested a review from lognaturel July 16, 2020 21:33
if nested_setvalues:
for setvalue in nested_setvalues:
msg = (
"Trigger was added for ${%s} that refers to hidden question. This is not allowed."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found this error message hard to parse. How about flipping it around so it's something like "${%s} is not a user-visible question so it can't be used as a calculation trigger for question ${%s}"? The first string would be the trigger (self.name) and the second would be the question that the trigger is set for (setvalue[0]). Hopefully I got that right.

I don't feel too strongly about it. If you prefer the current message, "to hidden question" -> "to a hidden question"

"Trigger was added for ${one-ts} that refers to hidden question. This is not allowed."
],
)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Were you thinking that a test for a typed calculate is not necessary because test_non_calculate_type_with_calculation_and_no_label_has_no_control checks the branch in question.py? I'd still add one for completeness (test_typed_calculate_cant_be_used_as_trigger or something).

Copy link
Contributor

@lognaturel lognaturel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll merge and follow up with a PR for your consideration.

@lognaturel lognaturel merged commit ef8bd00 into XLSForm:master Jul 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants