Fixes table sort for file size (#86)

* Fixed algorithm to de-humanize size string to bytes

* Resolved linting issues
This commit is contained in:
2023-01-16 22:50:25 +01:00
committed by GitHub
parent ba3cb6486e
commit 28a559727f
3 changed files with 10 additions and 8 deletions

View File

@@ -131,12 +131,12 @@
function sortSize() {
const torrentsCopy = [...torrents.value];
if (direction.value) {
torrents.value = torrentsCopy.sort(
(a, b) => sortableSize(a.size) - sortableSize(b.size)
torrents.value = torrentsCopy.sort((a, b) =>
sortableSize(a.size) > sortableSize(b.size) ? 1 : -1
);
} else {
torrents.value = torrentsCopy.sort(
(a, b) => sortableSize(b.size) - sortableSize(a.size)
torrents.value = torrentsCopy.sort((a, b) =>
sortableSize(a.size) < sortableSize(b.size) ? 1 : -1
);
}
}