From 318cd34f819dbc054ccd3a9bae4625e4bc48a01b Mon Sep 17 00:00:00 2001 From: Dan Date: Wed, 11 Aug 2021 14:21:23 -0400 Subject: [PATCH] bouncing to fix a bug in SpiffWorkflow that was holding outo outdated data deed within the python_script_engine. This caused validation to fail for valid repeat sections, so including a fix to allow that validation to continue. --- Pipfile.lock | 2 +- crc/services/workflow_service.py | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Pipfile.lock b/Pipfile.lock index eb82ab7e..2b7bf98a 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -979,7 +979,7 @@ }, "spiffworkflow": { "git": "https://github.com/sartography/SpiffWorkflow.git", - "ref": "1df28b940ec0d32b672e59e3d17e7a804cb2b186" + "ref": "e266745f6ff74995f125dd3821eab36cfe745a54" }, "sqlalchemy": { "hashes": [ diff --git a/crc/services/workflow_service.py b/crc/services/workflow_service.py index 63eda27b..895cccfb 100644 --- a/crc/services/workflow_service.py +++ b/crc/services/workflow_service.py @@ -1,3 +1,4 @@ +import copy import string from datetime import datetime import random @@ -328,7 +329,13 @@ class WorkflowService(object): # Then you must evaluate the expression based on the data within the group only. group = field.get_property(Task.FIELD_PROP_REPEAT) if group in task.data: + # Here we must make the current group data top level (as it would be in a repeat section) but + # make all other top level task data available as well. + new_data = copy.deepcopy(task.data) + del(new_data[group]) data = task.data[group][0] + data.update(new_data) + try: return task.workflow.script_engine.eval(expression, data) except Exception as e: