Format code with VSC
This commit is contained in:
@@ -247,18 +247,27 @@ const filterTorrentsByLabels = (
|
|||||||
export const getTorrentsRatio = (
|
export const getTorrentsRatio = (
|
||||||
widget: ITorrent,
|
widget: ITorrent,
|
||||||
torrents: NormalizedTorrent[],
|
torrents: NormalizedTorrent[],
|
||||||
applyAllFilter:boolean
|
applyAllFilter: boolean
|
||||||
) => {
|
) => {
|
||||||
|
if (applyAllFilter) {
|
||||||
if(applyAllFilter) {
|
torrents = filterTorrents(widget, torrents);
|
||||||
torrents = filterTorrents(widget,torrents)
|
|
||||||
} else if (widget.properties.labelFilter.length > 0) {
|
} else if (widget.properties.labelFilter.length > 0) {
|
||||||
torrents = filterTorrentsByLabels(torrents, widget.properties.labelFilter,widget.properties.labelFilterIsWhitelist)
|
torrents = filterTorrentsByLabels(
|
||||||
|
torrents,
|
||||||
|
widget.properties.labelFilter,
|
||||||
|
widget.properties.labelFilterIsWhitelist
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
let totalDownloadedSum = torrents.reduce((sum, torrent) => sum + torrent.totalDownloaded, 0);
|
let totalDownloadedSum = torrents.reduce(
|
||||||
|
(sum, torrent) => sum + torrent.totalDownloaded,
|
||||||
|
0
|
||||||
|
);
|
||||||
|
|
||||||
return totalDownloadedSum > 0 ? torrents.reduce((sum, torrent) => sum + torrent.totalUploaded, 0) / totalDownloadedSum : -1;
|
return totalDownloadedSum > 0
|
||||||
}
|
? torrents.reduce((sum, torrent) => sum + torrent.totalUploaded, 0) /
|
||||||
|
totalDownloadedSum
|
||||||
|
: -1;
|
||||||
|
};
|
||||||
|
|
||||||
export default definition;
|
export default definition;
|
||||||
|
|||||||
Reference in New Issue
Block a user