Skip to content

Commit d2ed262

Browse files
authored
Merge pull request #3820 from nextcloud/fix/list-sorting/next
fix sorting of poll list
2 parents 251903e + cbfc456 commit d2ed262

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/stores/polls.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -192,13 +192,13 @@ export const usePollsStore = defineStore('polls', {
192192
},
193193

194194
/*
195-
* polls list, filtered by category
195+
* polls list, filtered by category
196196
*/
197197
pollsByCategory: (state: PollList) => (filterId: FilterType) => {
198198
const useCategory = state.categories.find((category) => category.id === filterId)
199199
return state.list.filter((poll) => useCategory.filterCondition(poll))
200200
},
201-
201+
202202
pollsCount(state: PollList): Array<{ id: string, count: number }> {
203203
const count = []
204204
for (const category of state.categories) {
@@ -212,7 +212,7 @@ export const usePollsStore = defineStore('polls', {
212212
pollsFilteredSorted(state: PollList): Poll[] {
213213
return orderBy(
214214
this.pollsByCategory(this.currentCategory.id),
215-
[state.sort.by],
215+
[sortColumnsMapping[state.sort.by]],
216216
[state.sort.reverse ? 'desc' : 'asc'],
217217
)
218218
},
@@ -280,15 +280,15 @@ export const usePollsStore = defineStore('polls', {
280280
this.list = response.data.list
281281
this.meta.status = StatusResults.Loaded
282282
} catch (e) {
283-
if (e?.code === 'ERR_CANCELED') return
283+
if (e?.code === 'ERR_CANCELED') return
284284
this.meta.status = StatusResults.Error
285285
Logger.error('Error loading polls', { error: e.response })
286286
throw e
287287
}
288288
},
289289

290290
async setSort(payload: { sortBy: SortType }): Promise<void> {
291-
if (this.sort.by === sortColumnsMapping[payload.sortBy]) {
291+
if (this.sort.by === payload.sortBy) {
292292
this.sort.reverse = !this.sort.reverse
293293
} else {
294294
this.sort.reverse = true

0 commit comments

Comments
 (0)