1
0

fix(filter): make sure single filter condition works

This commit is contained in:
kolaente 2023-11-21 18:22:56 +01:00
parent de320aac72
commit c1e137d8ee
No known key found for this signature in database
GPG Key ID: F40E70337AB24C9B

View File

@ -210,13 +210,17 @@ 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 {
for i, f := range filters { if len(filters) == 1 {
if len(filters) > i+1 { filterCond = filters[0]
switch opts.filters[i].join { } else {
case filterConcatOr: for i, f := range filters {
filterCond = builder.Or(filterCond, f, filters[i+1]) if len(filters) > i+1 {
case filterConcatAnd: switch opts.filters[i+1].join {
filterCond = builder.And(filterCond, f, filters[i+1]) case filterConcatOr:
filterCond = builder.Or(filterCond, f, filters[i+1])
case filterConcatAnd:
filterCond = builder.And(filterCond, f, filters[i+1])
}
} }
} }
} }