mirror of
https://github.com/sartography/spiff-arena.git
synced 2025-02-10 00:25:18 +00:00
handle when parent is none when getting last state change (#453)
Co-authored-by: burnettk <burnettk@users.noreply.github.com>
This commit is contained in:
parent
8160d174bc
commit
ad7a4cd1e9
@ -1,5 +1,6 @@
|
|||||||
import copy
|
import copy
|
||||||
import json
|
import json
|
||||||
|
import time
|
||||||
import uuid
|
import uuid
|
||||||
from hashlib import sha256
|
from hashlib import sha256
|
||||||
|
|
||||||
@ -218,7 +219,10 @@ class VersionOneThree:
|
|||||||
task_models = TaskModel.query.filter(TaskModel.properties_json.like('%last_state_change": null%')).all() # type: ignore
|
task_models = TaskModel.query.filter(TaskModel.properties_json.like('%last_state_change": null%')).all() # type: ignore
|
||||||
for task_model in task_models:
|
for task_model in task_models:
|
||||||
parent_task_model = task_model.parent_task_model()
|
parent_task_model = task_model.parent_task_model()
|
||||||
task_model.properties_json["last_state_change"] = parent_task_model.properties_json["last_state_change"]
|
last_state_change = time.time()
|
||||||
|
if parent_task_model is not None:
|
||||||
|
last_state_change = parent_task_model.properties_json["last_state_change"]
|
||||||
|
task_model.properties_json["last_state_change"] = last_state_change
|
||||||
task_model.properties_json["task_spec"] = task_model.task_definition.bpmn_identifier
|
task_model.properties_json["task_spec"] = task_model.task_definition.bpmn_identifier
|
||||||
flag_modified(task_model, "properties_json") # type: ignore
|
flag_modified(task_model, "properties_json") # type: ignore
|
||||||
db.session.bulk_save_objects(task_models)
|
db.session.bulk_save_objects(task_models)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user