pyl and fix test w/ burnettk

This commit is contained in:
jasquat 2022-12-13 16:44:46 -05:00
parent 4f2f73e728
commit de69b05b30
6 changed files with 24 additions and 16 deletions

View File

@ -1,3 +1,4 @@
"""Process_instance_metadata."""
from dataclasses import dataclass
from flask_bpmn.models.db import db

View File

@ -21,7 +21,7 @@ class SpiffStepDetailsModel(SpiffworkflowBaseDBModel):
ForeignKey(ProcessInstanceModel.id), nullable=False # type: ignore
)
spiff_step: int = db.Column(db.Integer, nullable=False)
task_json: str = deferred(db.Column(db.JSON, nullable=False)) # type: ignore
task_json: dict = deferred(db.Column(db.JSON, nullable=False)) # type: ignore
timestamp: float = db.Column(db.DECIMAL(17, 6), nullable=False)
completed_by_user_id: int = db.Column(db.Integer, nullable=True)
lane_assignment_id: Optional[int] = db.Column(

View File

@ -1433,8 +1433,8 @@ def process_instance_task_list(
)
if step_detail is not None and process_instance.bpmn_json is not None:
bpmn_json = json.loads(process_instance.bpmn_json)
bpmn_json["tasks"] = step_detail.task_json['tasks']
bpmn_json["subprocesses"] = step_detail.task_json['subprocesses']
bpmn_json["tasks"] = step_detail.task_json["tasks"]
bpmn_json["subprocesses"] = step_detail.task_json["subprocesses"]
process_instance.bpmn_json = json.dumps(bpmn_json)
processor = ProcessInstanceProcessor(process_instance)

View File

@ -551,10 +551,7 @@ class ProcessInstanceProcessor:
"""SaveSpiffStepDetails."""
bpmn_json = self.serialize()
wf_json = json.loads(bpmn_json)
task_json = {
"tasks": wf_json["tasks"],
"subprocesses": wf_json["subprocesses"]
}
task_json = {"tasks": wf_json["tasks"], "subprocesses": wf_json["subprocesses"]}
return {
"process_instance_id": self.process_instance_model.id,

View File

@ -167,17 +167,22 @@ class SpecFileService(FileSystemService):
for ref in references:
# If no valid primary process is defined, default to the first process in the
# updated file.
if not process_model_info.primary_file_name and not primary_process_ref and ref.type == "process" and ref.is_executable:
if not primary_process_ref and ref.type == "process" and ref.is_executable:
ref.is_primary = True
if ref.is_primary:
ProcessModelService.update_process_model(
process_model_info,
{
"primary_process_id": ref.identifier,
"primary_file_name": file_name,
},
)
update_hash = {}
if not process_model_info.primary_file_name:
update_hash["primary_process_id"] = ref.identifier
update_hash["primary_file_name"] = file_name
elif file_name == process_model_info.primary_file_name:
update_hash["primary_process_id"] = ref.identifier
if len(update_hash) > 0:
ProcessModelService.update_process_model(
process_model_info,
update_hash,
)
SpecFileService.update_caches(ref)
return file

View File

@ -300,8 +300,13 @@ export default function ProcessInstanceListTable({
checkFiltersAndRun();
if (autoReload) {
return refreshAtInterval(REFRESH_INTERVAL, REFRESH_TIMEOUT, checkFiltersAndRun);
return refreshAtInterval(
REFRESH_INTERVAL,
REFRESH_TIMEOUT,
checkFiltersAndRun
);
}
return undefined;
}, [
autoReload,
searchParams,