use a slightly safer time in migration script. w/ jlantz

This commit is contained in:
burnettk 2023-08-29 12:22:43 -04:00
parent 6f8528dc1d
commit c063a4f84c
2 changed files with 8 additions and 3 deletions

3
.gitignore vendored
View File

@ -6,4 +6,5 @@ t
version_info.json version_info.json
.coverage* .coverage*
UNKNOWN.egg-info/ UNKNOWN.egg-info/
process_models/ process_models/
.ipynb_checkpoints

View File

@ -1,6 +1,5 @@
import copy import copy
import json import json
import time
import uuid import uuid
from hashlib import sha256 from hashlib import sha256
@ -219,9 +218,14 @@ 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()
last_state_change = time.time()
# we really don't know what to set this to if there is no parent_task_model,
# so let spiff fix it for us by telling it it is out of date
last_state_change = 0
if parent_task_model is not None: if parent_task_model is not None:
last_state_change = parent_task_model.properties_json["last_state_change"] 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["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