fix: sorting for saved filters
continuous-integration/drone/push Build is passing Details

resolves #786
This commit is contained in:
kolaente 2021-11-14 21:03:55 +01:00
parent 88a2cede19
commit 57e5d10eee
Signed by: konrad
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
}
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)
}

View File

@ -1081,6 +1081,24 @@ func TestTaskCollection_ReadAll(t *testing.T) {
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 {