Made changes to how soft_reset works so it is backward compatible - essentially, we use the file if we are doing a soft-reset or a new workflow. NB, this may actually still have problems if we have a workflow with P/SMI and we do a soft-reset on it even if there are no structural changes.

Also, change how default_value is interpreted, looking at the object attribute rather than the properties list.
This commit is contained in:
Kelly McDonald 2020-10-09 11:00:33 -04:00
parent 8b23cdc05c
commit 849a4e9f94
2 changed files with 5 additions and 3 deletions

View File

@ -134,17 +134,19 @@ class WorkflowProcessor(object):
which should work in casees where a soft reset fails. which should work in casees where a soft reset fails.
If neither flag is set, it will use the same version of the specification that was used to originally If neither flag is set, it will use the same version of the specification that was used to originally
create the workflow model. """ create the workflow model. """
self.workflow_model = workflow_model self.workflow_model = workflow_model
if soft_reset or len(workflow_model.dependencies) == 0: # Depenencies of 0 means the workflow was never started. if soft_reset or len(workflow_model.dependencies) == 0: # Depenencies of 0 means the workflow was never started.
self.spec_data_files = FileService.get_spec_data_files( self.spec_data_files = FileService.get_spec_data_files(
workflow_spec_id=workflow_model.workflow_spec_id) workflow_spec_id=workflow_model.workflow_spec_id)
spec = self.get_spec(self.spec_data_files, workflow_model.workflow_spec_id)
else: else:
self.spec_data_files = FileService.get_spec_data_files( self.spec_data_files = FileService.get_spec_data_files(
workflow_spec_id=workflow_model.workflow_spec_id, workflow_spec_id=workflow_model.workflow_spec_id,
workflow_id=workflow_model.id) workflow_id=workflow_model.id)
spec = None
spec = self.get_spec(self.spec_data_files, workflow_model.workflow_spec_id)
self.workflow_spec_id = workflow_model.workflow_spec_id self.workflow_spec_id = workflow_model.workflow_spec_id
try: try:
self.bpmn_workflow = self.__get_bpmn_workflow(workflow_model, spec, validate_only) self.bpmn_workflow = self.__get_bpmn_workflow(workflow_model, spec, validate_only)
@ -186,7 +188,7 @@ class WorkflowProcessor(object):
def __get_bpmn_workflow(self, workflow_model: WorkflowModel, spec: WorkflowSpec, validate_only=False): def __get_bpmn_workflow(self, workflow_model: WorkflowModel, spec: WorkflowSpec, validate_only=False):
if workflow_model.bpmn_workflow_json: if workflow_model.bpmn_workflow_json:
bpmn_workflow = self._serializer.deserialize_workflow(workflow_model.bpmn_workflow_json, bpmn_workflow = self._serializer.deserialize_workflow(workflow_model.bpmn_workflow_json,
workflow_spec=None) workflow_spec=spec)
else: else:
bpmn_workflow = BpmnWorkflow(spec, script_engine=self._script_engine) bpmn_workflow = BpmnWorkflow(spec, script_engine=self._script_engine)
bpmn_workflow.data[WorkflowProcessor.STUDY_ID_KEY] = workflow_model.study_id bpmn_workflow.data[WorkflowProcessor.STUDY_ID_KEY] = workflow_model.study_id

View File

@ -141,7 +141,7 @@ class WorkflowService(object):
continue continue
# If there is a default value, set it. # If there is a default value, set it.
if field.has_property('default_value') and field.default_value: if hasattr(field,'default_value') and field.default_value:
form_data[field.id] = WorkflowService.get_default_value(field, task) form_data[field.id] = WorkflowService.get_default_value(field, task)
# If we are only populating required fields, and this isn't required. stop here. # If we are only populating required fields, and this isn't required. stop here.