fix(filter): make sure single filter condition works
This commit is contained in:
parent
de320aac72
commit
c1e137d8ee
@ -210,9 +210,12 @@ func (d *dbTaskSearcher) Search(opts *taskSearchOptions) (tasks []*Task, totalCo
|
|||||||
|
|
||||||
var filterCond builder.Cond
|
var filterCond builder.Cond
|
||||||
if len(filters) > 0 {
|
if len(filters) > 0 {
|
||||||
|
if len(filters) == 1 {
|
||||||
|
filterCond = filters[0]
|
||||||
|
} else {
|
||||||
for i, f := range filters {
|
for i, f := range filters {
|
||||||
if len(filters) > i+1 {
|
if len(filters) > i+1 {
|
||||||
switch opts.filters[i].join {
|
switch opts.filters[i+1].join {
|
||||||
case filterConcatOr:
|
case filterConcatOr:
|
||||||
filterCond = builder.Or(filterCond, f, filters[i+1])
|
filterCond = builder.Or(filterCond, f, filters[i+1])
|
||||||
case filterConcatAnd:
|
case filterConcatAnd:
|
||||||
@ -221,6 +224,7 @@ func (d *dbTaskSearcher) Search(opts *taskSearchOptions) (tasks []*Task, totalCo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
limit, start := getLimitFromPageIndex(opts.page, opts.perPage)
|
limit, start := getLimitFromPageIndex(opts.page, opts.perPage)
|
||||||
cond := builder.And(builder.Or(projectIDCond, favoritesCond), where, filterCond)
|
cond := builder.And(builder.Or(projectIDCond, favoritesCond), where, filterCond)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user