fix: task filter "reminders" uses new Reminder object
All checks were successful
continuous-integration/drone/pr Build is passing
All checks were successful
continuous-integration/drone/pr Build is passing
This commit is contained in:
parent
e0487516a3
commit
d8630e9680
|
@ -266,6 +266,13 @@ func getNativeValueForTaskField(fieldName string, comparator taskFilterComparato
|
||||||
return nil, nil, ErrInvalidTaskField{TaskField: fieldName}
|
return nil, nil, ErrInvalidTaskField{TaskField: fieldName}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if realFieldName == "Reminders" {
|
||||||
|
field, ok = reflect.TypeOf(&TaskReminder{}).Elem().FieldByName("Reminder")
|
||||||
|
if !ok {
|
||||||
|
return nil, nil, ErrInvalidTaskField{TaskField: fieldName}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if comparator == taskFilterComparatorIn {
|
if comparator == taskFilterComparatorIn {
|
||||||
vals := strings.Split(value, ",")
|
vals := strings.Split(value, ",")
|
||||||
valueSlice := []interface{}{}
|
valueSlice := []interface{}{}
|
||||||
|
|
|
@ -933,7 +933,7 @@ func TestTaskCollection_ReadAll(t *testing.T) {
|
||||||
{
|
{
|
||||||
name: "filtered reminder dates",
|
name: "filtered reminder dates",
|
||||||
fields: fields{
|
fields: fields{
|
||||||
FilterBy: []string{"ReminderDates", "ReminderDates"},
|
FilterBy: []string{"reminders", "reminders"},
|
||||||
FilterValue: []string{"2018-10-01T00:00:00+00:00", "2018-12-10T00:00:00+00:00"},
|
FilterValue: []string{"2018-10-01T00:00:00+00:00", "2018-12-10T00:00:00+00:00"},
|
||||||
FilterComparator: []string{"greater", "less"},
|
FilterComparator: []string{"greater", "less"},
|
||||||
},
|
},
|
||||||
|
|
|
@ -338,7 +338,7 @@ func getRawTasksForLists(s *xorm.Session, lists []*List, a web.Auth, opts *taskO
|
||||||
var filters = make([]builder.Cond, 0, len(opts.filters))
|
var filters = make([]builder.Cond, 0, len(opts.filters))
|
||||||
// To still find tasks with nil values, we exclude 0s when comparing with >/< values.
|
// To still find tasks with nil values, we exclude 0s when comparing with >/< values.
|
||||||
for _, f := range opts.filters {
|
for _, f := range opts.filters {
|
||||||
if f.field == "ReminderDates" {
|
if f.field == "reminders" {
|
||||||
f.field = "reminder" // This is the name in the db
|
f.field = "reminder" // This is the name in the db
|
||||||
filter, err := getFilterCond(f, opts.filterIncludeNulls)
|
filter, err := getFilterCond(f, opts.filterIncludeNulls)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user