Merge pull request #416 from sartography/bug/fix-hide-518

Fixes validation for #518
This commit is contained in:
Dan Funk 2021-11-01 16:22:24 -04:00 committed by GitHub
commit 8a6c1e1b51
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View File

@ -363,6 +363,10 @@ class WorkflowService(object):
def evaluate_property(property_name, field, task):
expression = field.get_property(property_name)
data = task.data
# If there's a field key with no initial value, give it one (None)
for field in task.task_spec.form.fields:
if field.id not in data:
data[field.id] = None
if field.has_property(Task.FIELD_PROP_REPEAT):
# Then you must evaluate the expression based on the data within the group, if that data exists.
# There may not be data available in the group, if no groups where added

View File

@ -3,6 +3,7 @@ from tests.base_test import BaseTest
class TestValueExpression(BaseTest):
# If there is no default value, a value of 'None' should be given.
def test_value_expression_no_default(self):
workflow = self.create_workflow('test_value_expression')
@ -14,7 +15,7 @@ class TestValueExpression(BaseTest):
workflow_api = self.get_workflow_api(workflow)
second_task = workflow_api.next_task
self.assertEqual('', second_task.data['value_expression_value'])
self.assertNotIn('color', second_task.data)
self.assertIn('color', second_task.data)