fix: task filter "reminders" uses new Reminder object
continuous-integration/drone/pr Build is passing
Details
continuous-integration/drone/pr Build is passing
Details
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}
|
||||
}
|
||||
|
||||
if realFieldName == "Reminders" {
|
||||
field, ok = reflect.TypeOf(&TaskReminder{}).Elem().FieldByName("Reminder")
|
||||
if !ok {
|
||||
return nil, nil, ErrInvalidTaskField{TaskField: fieldName}
|
||||
}
|
||||
}
|
||||
|
||||
if comparator == taskFilterComparatorIn {
|
||||
vals := strings.Split(value, ",")
|
||||
valueSlice := []interface{}{}
|
||||
|
|
|
@ -933,7 +933,7 @@ func TestTaskCollection_ReadAll(t *testing.T) {
|
|||
{
|
||||
name: "filtered reminder dates",
|
||||
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"},
|
||||
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))
|
||||
// To still find tasks with nil values, we exclude 0s when comparing with >/< values.
|
||||
for _, f := range opts.filters {
|
||||
if f.field == "ReminderDates" {
|
||||
if f.field == "reminders" {
|
||||
f.field = "reminder" // This is the name in the db
|
||||
filter, err := getFilterCond(f, opts.filterIncludeNulls)
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in New Issue