chore(filters): cleanup old variables
This commit is contained in:
parent
65e1357705
commit
87c027aafd
@ -175,9 +175,8 @@ func (b *Bucket) ReadAll(s *xorm.Session, auth web.Auth, search string, page int
|
|||||||
opts.page = page
|
opts.page = page
|
||||||
opts.perPage = perPage
|
opts.perPage = perPage
|
||||||
opts.search = search
|
opts.search = search
|
||||||
opts.filterConcat = filterConcatAnd
|
|
||||||
|
|
||||||
for _, filter := range opts.filters {
|
for _, filter := range opts.parsedFilters {
|
||||||
if filter.field == taskPropertyBucketID {
|
if filter.field == taskPropertyBucketID {
|
||||||
|
|
||||||
// Limiting the map to the one filter we're looking for is the easiest way to ensure we only
|
// Limiting the map to the one filter we're looking for is the easiest way to ensure we only
|
||||||
@ -201,7 +200,7 @@ func (b *Bucket) ReadAll(s *xorm.Session, auth web.Auth, search string, page int
|
|||||||
} else {
|
} else {
|
||||||
filterString = "(" + originalFilter + ") && bucket_id = " + strconv.FormatInt(id, 10)
|
filterString = "(" + originalFilter + ") && bucket_id = " + strconv.FormatInt(id, 10)
|
||||||
}
|
}
|
||||||
opts.filters, err = getTaskFiltersFromFilterString(filterString)
|
opts.parsedFilters, err = getTaskFiltersFromFilterString(filterString)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -105,7 +105,7 @@ func getTaskFilterOptsFromCollection(tf *TaskCollection) (opts *taskSearchOption
|
|||||||
filter: tf.Filter,
|
filter: tf.Filter,
|
||||||
}
|
}
|
||||||
|
|
||||||
opts.filters, err = getTaskFiltersFromFilterString(tf.Filter)
|
opts.parsedFilters, err = getTaskFiltersFromFilterString(tf.Filter)
|
||||||
return opts, err
|
return opts, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1387,6 +1387,8 @@ func TestTaskCollection_ReadAll(t *testing.T) {
|
|||||||
task9,
|
task9,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
// TODO unix dates
|
||||||
|
// TODO date magic
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
|
@ -204,7 +204,7 @@ func (d *dbTaskSearcher) Search(opts *taskSearchOptions) (tasks []*Task, totalCo
|
|||||||
return nil, 0, err
|
return nil, 0, err
|
||||||
}
|
}
|
||||||
|
|
||||||
filterCond, err := convertFiltersToDBFilterCond(opts.filters, opts.filterIncludeNulls)
|
filterCond, err := convertFiltersToDBFilterCond(opts.parsedFilters, opts.filterIncludeNulls)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, 0, err
|
return nil, 0, err
|
||||||
}
|
}
|
||||||
@ -348,7 +348,7 @@ func (t *typesenseTaskSearcher) Search(opts *taskSearchOptions) (tasks []*Task,
|
|||||||
"project_id: [" + strings.Join(projectIDStrings, ", ") + "]",
|
"project_id: [" + strings.Join(projectIDStrings, ", ") + "]",
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, f := range opts.filters {
|
for _, f := range opts.parsedFilters {
|
||||||
|
|
||||||
if f.field == "reminders" {
|
if f.field == "reminders" {
|
||||||
f.field = "reminders.reminder"
|
f.field = "reminders.reminder"
|
||||||
|
@ -167,13 +167,11 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type taskSearchOptions struct {
|
type taskSearchOptions struct {
|
||||||
search string
|
search string
|
||||||
page int
|
page int
|
||||||
perPage int
|
perPage int
|
||||||
sortby []*sortParam
|
sortby []*sortParam
|
||||||
filters []*taskFilter
|
parsedFilters []*taskFilter
|
||||||
// deprecated: concat should live in filters directly
|
|
||||||
filterConcat taskFilterConcatinator
|
|
||||||
filterIncludeNulls bool
|
filterIncludeNulls bool
|
||||||
filter string
|
filter string
|
||||||
projectIDs []int64
|
projectIDs []int64
|
||||||
@ -267,11 +265,6 @@ func getRawTasksForProjects(s *xorm.Session, projects []*Project, a web.Auth, op
|
|||||||
return nil, 0, 0, nil
|
return nil, 0, 0, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the default concatinator of filter variables to or if none was provided
|
|
||||||
if opts.filterConcat == "" {
|
|
||||||
opts.filterConcat = filterConcatOr
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get all project IDs and get the tasks
|
// Get all project IDs and get the tasks
|
||||||
opts.projectIDs = []int64{}
|
opts.projectIDs = []int64{}
|
||||||
var hasFavoritesProject bool
|
var hasFavoritesProject bool
|
||||||
|
Loading…
x
Reference in New Issue
Block a user