1
0
forked from vikunja/vikunja

fix(task): only count unique tasks in a bucket when checking bucket limit

This fixes a bug where the current number of tasks in a bucket was computed wrong when moving tasks into a bucket with a limit. Sometimes the bug would prevent adding a task to a bucket which seemed to have space left but ultimately failed when moving the task.
This commit is contained in:
kolaente 2024-05-06 20:06:56 +02:00
parent 615d40f4cd
commit 7837bcfaae
Signed by untrusted user: konrad
GPG Key ID: F40E70337AB24C9B

View File

@ -640,6 +640,7 @@ func checkBucketLimit(s *xorm.Session, t *Task, bucket *Bucket) (err error) {
if bucket.Limit > 0 {
taskCount, err := s.
Where("bucket_id = ?", bucket.ID).
GroupBy("task_id").
Count(&TaskBucket{})
if err != nil {
return err