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

CARDS-2509: Reference question should support conditions based on sou… #1791

Open
wants to merge 8 commits into
base: dev
Choose a base branch
from

Conversation

acrowthe
Copy link
Contributor

@acrowthe acrowthe commented Jul 18, 2024

…rce form metadata

Add optional condition properties to reference questions:

  • conditionalProperty: A property on the referenced form to be evaluated
  • conditionalOperator: The operator that should be used for the comparison. Supports all operators supported by Conditional Sections
  • conditionalValue: The value that the property should be compared against
  • conditionalFallback: The value that should be saved instead of the referenced value if the condition is not satisfied
  • conditionalType: The type of the property that is being compared

Refactored backend conditional section code in order to reuse conditional evaluation code

Update Reference Test forms to add testing support for new conditional references

  • Added new section with 4 new questions to the bottom of ReferenceTestCopied. These questions are conditional on ReferenceTestUser being completed
  • Made one question in ReferenceTestUser mandatory to allow the form to be edited between incomplete and complete

To test:

  • Verify that form completion status works with mandatory questions in conditional sections as before as the code that updates completion status was adjusted in order to be reusable
  • Verify that the new questions in ReferenceTestCopied show:
    • Fallback values when ReferenceTestUser is incomplete
    • The values from ReferenceTestUser when that form is complete
  • Make sure to test reference answers on brand new forms and on forms that have been edited

@marta- marta- requested review from sdumitriu and sashaandjic July 18, 2024 19:10
@marta- marta- added the Test me! Ready for testing label Jul 18, 2024
@sashaandjic sashaandjic added the testing... Testing in progress label Jul 18, 2024
@sashaandjic sashaandjic added bug Something isn't working and removed Test me! Ready for testing testing... Testing in progress labels Sep 20, 2024
@sashaandjic
Copy link
Contributor

sashaandjic commented Sep 20, 2024

Steps to reproduce:

  • create Reference Test - User Answers form - fill in all fields ( I used text one, text one in section, 11, 11.11)
  • create another Reference Test - User Answers form - fill in all fields ( I used text two, text two in section, 22, 22.22)
  • create Reference Test - Copied Answers --> observe --> the form has values from the first form and everything looks good
  • go back to the first Reference Test - User Answers form and remove all values entered except in the Text question field
  • open Reference Test - User Answers form --> observe --> everything looks good
  • create another Reference Test - User Answers form - fill in all fields ( I used text three, text three in section, 33, 33.33)
  • open Reference Test - User Answers form --> observe --> the form has values from the first and the last form
    testRes

acrowthe and others added 6 commits November 7, 2024 11:23
…rce form metadata

Add optional condition properties to reference questions:
- conditionalProperty: A property on the referenced form to be evaluated
- conditionalOperator: The operator that should be used for the comparison.
                       Supports all operators supported by Conditional Sections
- conditionalValue: The value that the property should be compared against
- conditionalFallback: The value that should be saved instead of the
                       referenced value if the condition is not satisfied
- conditionalType: The type of the property that is being compared

Refactored backend conditional section code in order to reuse conditional evaluation code

Update Reference Test forms to add testing support for new conditional references
- Added new section with 4 new questions to the bottom of ReferenceTestCopied.
  These questions are conditional on ReferenceTestUser being completed
- Made one question in ReferenceTestUser mandatory to allow the form to be edited
  between incomplete and complete
…rce form metadata

Add optional error message when a conditional reference is not satisfied
- Allows non-text questions to have a text based error display
…rce form metadata

- Add invalid source flag to reference questions with no source
…rce form metadata

- Updated the import script to support conditional properties of reference questions
…rce form metadata

- Clean up unused javadoc
- Add missing conditional reference columns to questionnaire import
- Add missing null checks
…rce form metadata

- Rebase ontop of latest dev to pull in other reference question changes
- Code cleanup:
  - Refactor null checks to remove double negatives
  - Move condition utils to it's own module
  - Fix test form naming issues
  - Clean up constant string naming and reuse utility strings when available
…rce form metadata

Improve conditional references to not change source answers if a new valid source is edited while
  the original source does not meet the condition
@acrowthe acrowthe added Test me! Ready for testing and removed bug Something isn't working labels Nov 8, 2024
…rce form metadata

Cleanup: Remove ConditionalOperand and move functionality to base Operand
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Test me! Ready for testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants