Skip to content

Commit

Permalink
Fix download sort (#8338)
Browse files Browse the repository at this point in the history
  • Loading branch information
p0psicles authored Aug 16, 2020
1 parent 5bd92e5 commit af946d3
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
11 changes: 10 additions & 1 deletion themes-default/slim/src/mixins/show-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ export const showlistTableMixin = {
hidden: getCookie('Quality')
}, {
label: 'Downloads',
field: 'stats.tooltip.text',
field: 'stats.tooltip.percentage',
sortFn: this.sortDownloads,
type: 'boolean',
hidden: getCookie('Downloads')
}, {
label: 'Size',
Expand Down Expand Up @@ -179,6 +181,13 @@ export const showlistTableMixin = {
}

return (titleX < titleY ? -1 : (titleX > titleY ? 1 : 0));
},
sortDownloads(x, y, _, rowX, rowY) {
if ((x === 0 || x === 100) && x === y) {
return rowX.stats.episodes.total < rowY.stats.episodes.total ? -1 : (rowX.stats.episodes.total < rowY.stats.episodes.total ? 1 : 0);
}

return x < y ? -1 : (x > y ? 1 : 0);
}
}
};
2 changes: 1 addition & 1 deletion themes/dark/assets/js/medusa-runtime.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit af946d3

Please sign in to comment.