-
Notifications
You must be signed in to change notification settings - Fork 6
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
base: dev
Are you sure you want to change the base?
Conversation
…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
@@ -50,6 +50,9 @@ public interface FormUtils | |||
/** The name of the property of a Form node that links to other Subjects the form relates to. */ | |||
String RELATED_SUBJECTS_PROPERTY = "relatedSubjects"; | |||
|
|||
/** The name of a property on an Answer, Section or Form node that holds the status flags for that node.*/ | |||
String STATUS_FLAGS = "statusFlags"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
String STATUS_FLAGS = "statusFlags"; | |
String STATUS_FLAGS_PROPERTY = "statusFlags"; |
/** Answer's property name. **/ | ||
public static final String VALUE = "value"; | ||
/** Property on an answer node that stores the a reference to the question. */ | ||
public static final String QUESTION = "question"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's also FormUtils.QUESTION_PROPERTY
/** | ||
* Fill out a refernce answer with a value copied from the referenced question. | ||
* @param versionManager A version manager to be used to checkout forms if needed | ||
* @param checkoutPaths The list of forms that have been checkout out and need to be checked back in | ||
* @param sourceAnswerValue The source answer value to copy the answer from | ||
* @param referenceAnswer The reference answer to copy the value into | ||
* @param sourceNode The source answer node that the value is being copied from | ||
* @throws RepositoryException if an unexpected error occurs | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dangling comment?
*/ | ||
|
||
/** | ||
* Fill out a refernce answer with the value specified as the fallback value. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* Fill out a refernce answer with the value specified as the fallback value. | |
* Fill out a reference answer with the value specified as the fallback value. |
@@ -191,31 +187,234 @@ private void checkAndUpdateAnswersValues(final NodeIterator nodeIterator, final | |||
} | |||
} | |||
|
|||
private boolean isNotSame(final Property source, final Node reference) throws RepositoryException | |||
/** | |||
* Fill out a refernce answer with a value copied from the referenced question. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* Fill out a refernce answer with a value copied from the referenced question. | |
* Fill out a reference answer with a value copied from the referenced question. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I want to remove things from cards-utils, not add more things to it, so I'd like to see this moved into its own module, conditions
.
} | ||
} | ||
super(values); | ||
this.reference = reference; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be part of the default Operand?
…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
Add optional condition properties to reference questions:
Refactored backend conditional section code in order to reuse conditional evaluation code
Update Reference Test forms to add testing support for new conditional references
To test: