Enhancement: sort qBittorrent leechProgress (#5456)

This commit is contained in:
AdamWHY2K 2025-06-28 22:23:02 +01:00 committed by GitHub
parent 0a44a2dade
commit e215e7d70e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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 (
<>