fix: sorting for saved filters

resolves #786
This commit is contained in:
kolaente 2021-11-14 21:03:55 +01:00
parent 88a2cede19
commit 57e5d10eee
No known key found for this signature in database
GPG key ID: F40E70337AB24C9B
2 changed files with 23 additions and 0 deletions

View file

@ -149,6 +149,11 @@ func (tf *TaskCollection) ReadAll(s *xorm.Session, a web.Auth, search string, pa
return nil, 0, 0, err return nil, 0, 0, err
} }
sf.Filters.SortByArr = tf.SortByArr
sf.Filters.SortBy = tf.SortBy
sf.Filters.OrderByArr = tf.OrderByArr
sf.Filters.OrderBy = tf.OrderBy
return sf.getTaskCollection().ReadAll(s, a, search, page, perPage) return sf.getTaskCollection().ReadAll(s, a, search, page, perPage)
} }

View file

@ -1081,6 +1081,24 @@ func TestTaskCollection_ReadAll(t *testing.T) {
task2, task2,
}, },
}, },
{
name: "saved filter with sort order",
fields: fields{
ListID: -2,
SortBy: []string{"title", "id"},
OrderBy: []string{"desc", "asc"},
},
args: args{
a: &user.User{ID: 1},
},
want: []*Task{
task9,
task8,
task7,
task6,
task5,
},
},
} }
for _, tt := range tests { for _, tt := range tests {