Fixed labels not being queried correctly on tasks

This commit is contained in:
konrad 2019-03-22 22:03:41 +01:00
parent c42e22f352
commit 1dc14d5ddf
Signed by untrusted user: konrad
GPG Key ID: F40E70337AB24C9B
1 changed files with 2 additions and 2 deletions

View File

@ -153,7 +153,7 @@ func getLabelsByTaskIDs(opts *LabelByTaskIDsOptions) (ls []*labelWithTaskID, err
requestOrNil = "label_task.label_id != null OR labels.created_by_id = ?"
}
// Get all labels associated with these labels
// Get all labels associated with these tasks
var labels []*labelWithTaskID
err = x.Table("labels").
Select("labels.*, label_task.task_id").
@ -161,7 +161,7 @@ func getLabelsByTaskIDs(opts *LabelByTaskIDsOptions) (ls []*labelWithTaskID, err
Where(requestOrNil, uidOrNil).
Or(builder.In("label_task.task_id", opts.TaskIDs)).
And("labels.title LIKE ?", "%"+opts.Search+"%").
GroupBy("labels.id").
GroupBy("labels.id,label_task.task_id"). // This filters out doubles
Limit(getLimitFromPageIndex(opts.Page)).
Find(&labels)
if err != nil {