From c85da01294df9df83f603a7988febb70cc83f6ac Mon Sep 17 00:00:00 2001 From: kolaente Date: Wed, 28 Aug 2024 14:18:46 +0200 Subject: [PATCH] fix(task): set done at date when moving a task to the done bucket Resolves https://github.com/go-vikunja/vikunja/issues/320 (cherry picked from commit bf56311faa55146cac05dbf1ee7e02e542d22a90) --- pkg/models/kanban_task_bucket.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkg/models/kanban_task_bucket.go b/pkg/models/kanban_task_bucket.go index e825d50a9..ae9e39176 100644 --- a/pkg/models/kanban_task_bucket.go +++ b/pkg/models/kanban_task_bucket.go @@ -17,6 +17,8 @@ package models import ( + "time" + "code.vikunja.io/api/pkg/events" "code.vikunja.io/api/pkg/user" "code.vikunja.io/web" @@ -149,12 +151,18 @@ func (b *TaskBucket) Update(s *xorm.Session, a web.Auth) (err error) { } if doneChanged { + if task.Done { + task.DoneAt = time.Now() + } else { + task.DoneAt = time.Time{} + } _, err = s.Where("id = ?", task.ID). Cols( "done", "due_date", "start_date", "end_date", + "done_at", ). Update(task) if err != nil {