Permalink
Browse files

better total ratio calculation

  • Loading branch information...
1 parent f59b774 commit ac599e8694113644197760dcfbe354053e096266 @feross feross committed Mar 3, 2014
Showing with 5 additions and 5 deletions.
  1. +5 −5 lib/torrent-manager.js
View
@@ -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
}
})

0 comments on commit ac599e8

Please sign in to comment.