mirror of
https://github.com/zoriya/flood.git
synced 2026-06-06 12:02:13 +00:00
server: don't truncate percentCompleted to integer
It is frontend's job to handle this.
This commit is contained in:
@@ -139,7 +139,7 @@ class TransmissionClientGatewayService extends ClientGatewayService {
|
||||
index,
|
||||
path: file.name,
|
||||
filename: file.name.split('/').pop() as string,
|
||||
percentComplete: Math.trunc(file.bytesCompleted / file.length),
|
||||
percentComplete: file.bytesCompleted / file.length,
|
||||
priority,
|
||||
sizeBytes: file.length,
|
||||
};
|
||||
@@ -165,7 +165,7 @@ class TransmissionClientGatewayService extends ClientGatewayService {
|
||||
address: peer.address,
|
||||
country: geoip.lookup(peer.address)?.country || '',
|
||||
clientVersion: peer.clientName,
|
||||
completedPercent: Math.trunc(peer.progress * 100),
|
||||
completedPercent: peer.progress * 100,
|
||||
downloadRate: peer.rateToClient,
|
||||
uploadRate: peer.rateToPeer,
|
||||
isEncrypted: peer.isEncrypted,
|
||||
@@ -332,7 +332,7 @@ class TransmissionClientGatewayService extends ClientGatewayService {
|
||||
{},
|
||||
...(await Promise.all(
|
||||
torrents.map(async (torrent) => {
|
||||
const percentComplete = Math.trunc((torrent.haveValid / torrent.totalSize) * 100);
|
||||
const percentComplete = (torrent.haveValid / torrent.totalSize) * 100;
|
||||
const ratio = torrent.downloadedEver === 0 ? -1 : torrent.uploadedEver / torrent.downloadedEver;
|
||||
const trackerURIs = getDomainsFromURLs(torrent.trackers.map((tracker) => tracker.announce));
|
||||
const status = torrentPropertiesUtil.getTorrentStatus(torrent);
|
||||
|
||||
@@ -94,7 +94,7 @@ class QBittorrentClientGatewayService extends ClientGatewayService {
|
||||
index,
|
||||
path: content.name,
|
||||
filename: content.name.split('/').pop() || '',
|
||||
percentComplete: Math.trunc(content.progress * 100),
|
||||
percentComplete: content.progress * 100,
|
||||
priority,
|
||||
sizeBytes: content.size,
|
||||
};
|
||||
@@ -120,7 +120,7 @@ class QBittorrentClientGatewayService extends ClientGatewayService {
|
||||
address: peer.ip,
|
||||
country: peer.country_code,
|
||||
clientVersion: peer.client,
|
||||
completedPercent: Math.trunc(peer.progress * 100),
|
||||
completedPercent: peer.progress * 100,
|
||||
downloadRate: peer.dl_speed,
|
||||
uploadRate: peer.up_speed,
|
||||
isEncrypted: properties.isEncrypted,
|
||||
@@ -277,7 +277,7 @@ class QBittorrentClientGatewayService extends ClientGatewayService {
|
||||
name: info.name,
|
||||
peersConnected: info.num_leechs,
|
||||
peersTotal: info.num_incomplete,
|
||||
percentComplete: Math.trunc(info.progress * 100),
|
||||
percentComplete: info.progress * 100,
|
||||
priority: 1,
|
||||
ratio: info.ratio,
|
||||
seedsConnected: info.num_seeds,
|
||||
|
||||
@@ -196,7 +196,7 @@ class RTorrentClientGatewayService extends ClientGatewayService {
|
||||
index,
|
||||
path: content.path,
|
||||
filename: content.path.split('/').pop() || '',
|
||||
percentComplete: Math.trunc((content.completedChunks / content.sizeChunks) * 100),
|
||||
percentComplete: (content.completedChunks / content.sizeChunks) * 100,
|
||||
priority: content.priority,
|
||||
sizeBytes: content.sizeBytes,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user