Merge pull request #438 from sartography/bug/fix-task-data

Bug/fix task data
This commit is contained in:
Dan Funk 2021-12-13 13:31:37 -05:00 committed by GitHub
commit e62a99af96
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 8 deletions

View File

@ -375,11 +375,8 @@ class WorkflowService(object):
@staticmethod
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

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_00dbd41" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.2.0">
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_00dbd41" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.0.0">
<bpmn:process id="Process_SetStudyStatus" name="Set Study Status" isExecutable="true">
<bpmn:startEvent id="StartEvent_1">
<bpmn:outgoing>Flow_0c77bdh</bpmn:outgoing>
@ -8,10 +8,8 @@
<bpmn:extensionElements>
<camunda:formData>
<camunda:formField id="selected_status" label="Select Study Status" type="enum">
<camunda:value id="in_progress" name="In Progress" />
<camunda:value id="approved" name="Approved" />
<camunda:value id="disapproved" name="Disapproved" />
<camunda:value id="asdf" name="asdf" />
</camunda:formField>
</camunda:formData>
</bpmn:extensionElements>

View File

@ -15,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.assertIn('color', second_task.data)
self.assertNotIn('color', second_task.data)