mirror of
https://github.com/hcengineering/platform.git
synced 2026-09-07 10:17:42 +02:00
Check already completed cancelled todos (#9847)
Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
@@ -27,15 +27,36 @@ import process, {
|
||||
import { ExecuteResult, ProcessControl } from '@hcengineering/server-process'
|
||||
import time, { ToDoPriority } from '@hcengineering/time'
|
||||
|
||||
export function CheckToDo (
|
||||
export async function CheckToDoDone (
|
||||
control: ProcessControl,
|
||||
execution: Execution,
|
||||
params: Record<string, any>,
|
||||
context: Record<string, any>
|
||||
): boolean {
|
||||
): Promise<boolean> {
|
||||
if (params._id === undefined) return false
|
||||
if (context.todo === undefined) return false
|
||||
return context.todo._id === params._id
|
||||
if (context.todo !== undefined) {
|
||||
return context.todo._id === params._id
|
||||
} else {
|
||||
const todo = await control.client.findOne(process.class.ProcessToDo, { _id: params._id })
|
||||
if (todo === undefined) return false
|
||||
return todo.doneOn !== null
|
||||
}
|
||||
}
|
||||
|
||||
export async function CheckToDoCancelled (
|
||||
control: ProcessControl,
|
||||
execution: Execution,
|
||||
params: Record<string, any>,
|
||||
context: Record<string, any>
|
||||
): Promise<boolean> {
|
||||
if (params._id === undefined) return false
|
||||
if (context.todo !== undefined) {
|
||||
return context.todo._id === params._id
|
||||
} else {
|
||||
const todo = await control.client.findOne(process.class.ProcessToDo, { _id: params._id })
|
||||
if (todo === undefined) return false
|
||||
return todo.doneOn === null
|
||||
}
|
||||
}
|
||||
|
||||
export async function CheckSubProcessesDone (control: ProcessControl, execution: Execution): Promise<boolean> {
|
||||
|
||||
@@ -78,7 +78,8 @@ import {
|
||||
CreateCard,
|
||||
AddRelation,
|
||||
AddTag,
|
||||
CheckToDo,
|
||||
CheckToDoDone,
|
||||
CheckToDoCancelled,
|
||||
OnCardUpdateCheck,
|
||||
CheckSubProcessesDone,
|
||||
CheckTime
|
||||
@@ -355,7 +356,8 @@ export default async () => ({
|
||||
CreateCard,
|
||||
AddRelation,
|
||||
AddTag,
|
||||
CheckToDo,
|
||||
CheckToDoDone,
|
||||
CheckToDoCancelled,
|
||||
OnCardUpdateCheck,
|
||||
CheckSubProcessesDone,
|
||||
CheckTime
|
||||
|
||||
Reference in New Issue
Block a user