Fix task and model last_change handling

Improve db model index
Improve db model infrastructure
This commit is contained in:
allegroai
2021-01-05 18:17:29 +02:00
parent 29c792d459
commit 59994ccf9c
14 changed files with 80 additions and 35 deletions

View File

@@ -145,6 +145,7 @@ class TaskBLL:
company=identity.company,
created=now,
last_update=now,
last_change=now,
**fields,
)
@@ -237,6 +238,7 @@ class TaskBLL:
company=company_id,
created=now,
last_update=now,
last_change=now,
name=name or task.name,
comment=comment or task.comment,
parent=parent or task.parent,
@@ -367,7 +369,10 @@ class TaskBLL:
**extra_updates,
}
Task.objects(id=task.id, company=company_id).update(
upsert=False, last_update=last_update, **updates
upsert=False,
last_update=last_update,
last_change=last_update,
**updates,
)
@staticmethod
@@ -653,11 +658,7 @@ class TaskBLL:
@classmethod
def dequeue_and_change_status(
cls,
task: Task,
company_id: str,
status_message: str,
status_reason: str,
cls, task: Task, company_id: str, status_message: str, status_reason: str,
):
cls.dequeue(task, company_id)