mirror of
https://github.com/gethomepage/homepage.git
synced 2025-07-09 03:04:18 -04:00
Enhancement: sort qBittorrent leechProgress (#5456)
This commit is contained in:
parent
0a44a2dade
commit
e215e7d70e
@ -45,6 +45,25 @@ export default function Component({ service }) {
|
||||
}
|
||||
|
||||
const leech = torrentData.length - completed;
|
||||
const statePriority = [
|
||||
"downloading",
|
||||
"forcedDL",
|
||||
"metaDL",
|
||||
"forcedMetaDL",
|
||||
"checkingDL",
|
||||
"stalledDL",
|
||||
"queuedDL",
|
||||
"pausedDL",
|
||||
];
|
||||
|
||||
leechTorrents.sort((firstTorrent, secondTorrent) => {
|
||||
const firstStateIndex = statePriority.indexOf(firstTorrent.state);
|
||||
const secondStateIndex = statePriority.indexOf(secondTorrent.state);
|
||||
if (firstStateIndex !== secondStateIndex) {
|
||||
return firstStateIndex - secondStateIndex;
|
||||
}
|
||||
return secondTorrent.progress - firstTorrent.progress;
|
||||
});
|
||||
|
||||
return (
|
||||
<>
|
||||
|
Loading…
x
Reference in New Issue
Block a user