From 72e0e221521aba25e900d2a6fadb3d3c2bffe806 Mon Sep 17 00:00:00 2001 From: kolaente Date: Thu, 8 Jun 2023 16:56:05 +0200 Subject: [PATCH] feat(kanban): return the total task count per bucket --- pkg/models/kanban.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkg/models/kanban.go b/pkg/models/kanban.go index 146996bd47f..9893ef649af 100644 --- a/pkg/models/kanban.go +++ b/pkg/models/kanban.go @@ -41,6 +41,9 @@ type Bucket struct { // If this bucket is the "done bucket". All tasks moved into this bucket will automatically marked as done. All tasks marked as done from elsewhere will be moved into this bucket. IsDoneBucket bool `xorm:"BOOL" json:"is_done_bucket"` + // The number of tasks currently in this bucket + Count int64 `xorm:"-" json:"count"` + // The position this bucket has when querying all buckets. See the tasks.position property on how to use this. Position float64 `xorm:"double null" json:"position"` @@ -202,11 +205,13 @@ func (b *Bucket) ReadAll(s *xorm.Session, auth web.Auth, search string, page int opts.filters[bucketFilterIndex].value = id - ts, _, _, err := getRawTasksForProjects(s, []*Project{{ID: bucket.ProjectID}}, auth, opts) + ts, _, total, err := getRawTasksForProjects(s, []*Project{{ID: bucket.ProjectID}}, auth, opts) if err != nil { return nil, 0, 0, err } + bucket.Count = total + tasks = append(tasks, ts...) }