Skip to content

Commit 39c4009

Browse files
authored
Fix tracker todo close time tracking (#9636)
1 parent 1e31f25 commit 39c4009

File tree

1 file changed

+9
-2
lines changed
  • server-plugins/time-resources/src

1 file changed

+9
-2
lines changed

server-plugins/time-resources/src/index.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -358,8 +358,15 @@ export async function OnToDoUpdate (txes: Tx[], control: TriggerControl): Promis
358358
const visibility = updTx.operations.visibility
359359
if (doneOn != null) {
360360
const todo = (await control.findAll(control.ctx, time.class.ToDo, { _id: updTx.objectId }))[0]
361-
if (todo === undefined || todo.doneOn != null) {
362-
// Do not process already processed todos.
361+
if (todo === undefined) {
362+
continue
363+
}
364+
const wasProcessed = await control.findAll(control.ctx, core.class.TxUpdateDoc, {
365+
objectId: todo._id,
366+
doneOn: { $exists: true }
367+
})
368+
// Do not process already processed todos.
369+
if (wasProcessed.filter((p) => p._id !== tx._id).length > 0) {
363370
continue
364371
}
365372
const events = await control.findAll(control.ctx, time.class.WorkSlot, { attachedTo: updTx.objectId })

0 commit comments

Comments
 (0)