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 ef40720f31
commit 91eeddc275
No known key found for this signature in database
2 changed files with 8 additions and 3 deletions

3
.gitignore vendored
View File

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

View File

@ -1,6 +1,5 @@
import copy
import json
import time
import uuid
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
for task_model in task_models:
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:
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
flag_modified(task_model, "properties_json") # type: ignore