Skip to content

Commit 49dbbc2

Browse files
committed
Fix sort
1 parent ac51fc6 commit 49dbbc2

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

app/scripts/components/wordpicture/word-picture-column.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,10 @@ angular.module("korpApp").component("wordPictureColumn", {
6666

6767
$ctrl.$onChanges = (changes) => {
6868
if (changes.limit?.currentValue || changes.items?.currentValue || changes.segment?.currentValue) {
69-
$ctrl.rows = $ctrl.items.filter((item) => item.stats[$ctrl.segment]).slice(0, Number($ctrl.limit))
69+
$ctrl.rows = $ctrl.items
70+
.filter((item) => item.stats[$ctrl.segment])
71+
.sort((a, b) => b.stats[$ctrl.segment][$ctrl.sort] - a.stats[$ctrl.segment][$ctrl.sort])
72+
.slice(0, Number($ctrl.limit))
7073
}
7174
}
7275

0 commit comments

Comments
 (0)