fix: task filter "reminders" uses new Reminder object
continuous-integration/drone/pr Build is passing Details

This commit is contained in:
cernst 2023-03-07 19:50:49 +01:00
parent e0487516a3
commit d8630e9680
3 changed files with 9 additions and 2 deletions

View File

@ -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{}{}

View File

@ -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"},
},

View File

@ -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 {