avoid calling task_definition and bpmn_process_definition more than we need to w/ burnettk

This commit is contained in:
jasquat 2023-03-06 17:24:01 -05:00
parent 94776a78b5
commit 240c2372d2
1 changed files with 15 additions and 7 deletions

View File

@ -561,16 +561,24 @@ class ProcessInstanceProcessor:
.filter_by(bpmn_process_definition_parent_id=bpmn_process_definition.id) .filter_by(bpmn_process_definition_parent_id=bpmn_process_definition.id)
.all() .all()
) )
bpmn_subprocess_definition_bpmn_identifiers = {}
for bpmn_subprocess_definition in bpmn_process_subprocess_definitions: for bpmn_subprocess_definition in bpmn_process_subprocess_definitions:
spec = cls._get_definition_dict_for_bpmn_process_definition( bpmn_process_definition_dict: dict = bpmn_subprocess_definition.properties_json
bpmn_subprocess_definition
)
spiff_bpmn_process_dict["subprocess_specs"][ spiff_bpmn_process_dict["subprocess_specs"][
bpmn_subprocess_definition.bpmn_identifier bpmn_subprocess_definition.bpmn_identifier
] = spec ] = bpmn_process_definition_dict
cls._set_definition_dict_for_bpmn_subprocess_definitions( spiff_bpmn_process_dict["subprocess_specs"][
bpmn_subprocess_definition, spiff_bpmn_process_dict bpmn_subprocess_definition.bpmn_identifier
) ]['task_specs'] = {}
bpmn_subprocess_definition_bpmn_identifiers[bpmn_subprocess_definition.id] = bpmn_subprocess_definition.bpmn_identifier
task_definitions = TaskDefinitionModel.query.filter(
TaskDefinitionModel.bpmn_process_definition_id.in_(bpmn_subprocess_definition_bpmn_identifiers.keys()) # type: ignore
).all()
for task_definition in task_definitions:
bpmn_subprocess_definition_bpmn_identifier = bpmn_subprocess_definition_bpmn_identifiers[task_definition.bpmn_process_definition_id]
spiff_bpmn_process_dict["subprocess_specs"][bpmn_subprocess_definition_bpmn_identifier]['task_specs'][task_definition.bpmn_identifier] = task_definition.properties_json
@classmethod @classmethod
def _get_bpmn_process_dict(cls, bpmn_process: BpmnProcessModel) -> dict: def _get_bpmn_process_dict(cls, bpmn_process: BpmnProcessModel) -> dict: