You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When validating documents and answers, often we need to verify that all answers are valid (ever answer where is_required evaluates to True must be filled in, for example)
Now in complex structures, this becomes rather complex, as things like dynamic options, data sources etc come into play.
Proposal
We need to cache locally the resulting value of is_hidden and is_required in answers, as well as is_hidden in options.
To do this, I propose a similar structure to what we already have in the calculated questions: We start with a list of question slugs mentioned in the JEXL expressions. These questions then get a forward reference to our question with the expression.
Each time an answer with such a question is saved, we look for "dependent" answers and invalidate their is_hidden and is_required state, as well as their options' is_hidden if it's a [multiple]choice question.
The document/answer validator then checks the cached values instead of evaluating the JEXL every time:
if it's None, recalculate and save the result to database
if it's True or False, no recalculation required, just use the value as-is.
The text was updated successfully, but these errors were encountered:
When validating documents and answers, often we need to verify that all answers are valid (ever answer where
is_required
evaluates toTrue
must be filled in, for example)Now in complex structures, this becomes rather complex, as things like dynamic options, data sources etc come into play.
Proposal
We need to cache locally the resulting value of
is_hidden
andis_required
in answers, as well asis_hidden
in options.To do this, I propose a similar structure to what we already have in the calculated questions: We start with a list of question slugs mentioned in the JEXL expressions. These questions then get a forward reference to our question with the expression.
Each time an answer with such a question is saved, we look for "dependent" answers and invalidate their
is_hidden
andis_required
state, as well as their options'is_hidden
if it's a [multiple]choice question.The document/answer validator then checks the cached values instead of evaluating the JEXL every time:
None
, recalculate and save the result to databaseTrue
orFalse
, no recalculation required, just use the value as-is.The text was updated successfully, but these errors were encountered: