fix(task): set done at date when moving a task to the done bucket
Resolves https://github.com/go-vikunja/vikunja/issues/320
This commit is contained in:
parent
c38aaeb224
commit
bf56311faa
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Reference in New Issue