Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

better total ratio calculation

  • Loading branch information...
commit ac599e8694113644197760dcfbe354053e096266 1 parent f59b774
@feross authored
Showing with 5 additions and 5 deletions.
  1. +5 −5 lib/torrent-manager.js
View
10 lib/torrent-manager.js
@@ -60,15 +60,15 @@ Object.defineProperty(TorrentManager.prototype, 'ratio', {
get: function () {
var self = this
- var uploaded = self.torrents.reduce(function (acc, torrent) {
- return acc + torrent.swarm.uploaded
+ var uploaded = self.torrents.reduce(function (total, torrent) {
+ return total + torrent.uploaded
}, 0)
- var downloaded = self.torrents.reduce(function (acc, torrent) {
- return acc + torrent.swarm.downloaded
+ var downloaded = self.torrents.reduce(function (total, torrent) {
+ return total + torrent.downloaded
}, 0)
if (downloaded === 0) return 0
- else return uploaded / downloaded
+ return uploaded / downloaded
}
})
Please sign in to comment.
Something went wrong with that request. Please try again.