From e756500ffc1a1ff67176b32fb14d06c0073fe02e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Rodr=C3=ADguez?= Date: Tue, 1 Dec 2015 02:52:10 -0500 Subject: [PATCH] Fixed NaN showing --- app.coffee | 7 ++++++- index.jade | 6 +++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/app.coffee b/app.coffee index 83a99c3..c190ea6 100644 --- a/app.coffee +++ b/app.coffee @@ -94,7 +94,8 @@ app.controller 'bTorrentCtrl', ['$scope','$http','$log','$location', ($scope, $h return $scope.onTorrent = (torrent, isSeed) -> - $scope.client.processing = false + if !isSeed + $scope.client.processing = false torrent.pSize = torrent.length torrent.showFiles = false torrent.fileName = torrent.name + '.torrent' @@ -120,6 +121,8 @@ app.controller 'bTorrentCtrl', ['$scope','$http','$log','$location', ($scope, $h file.getBlobURL (err, url) -> if err throw err + if isSeed + $scope.client.processing = false file.url = url if !isSeed dbg 'Finished downloading file ' + file.name, torrent @@ -166,6 +169,8 @@ app.filter 'html', ['$sce', ($sce) -> app.filter 'pbytes', -> (num) -> + if isNaN(num) + return '' exponent = undefined unit = undefined neg = num < 0 diff --git a/index.jade b/index.jade index e2fc87c..654cf6f 100644 --- a/index.jade +++ b/index.jade @@ -16,7 +16,7 @@ html(ng-app='bTorrent', lang='en') header h1 | βTorrent - span.version v0.5 + span.version v0.5.01 .container(ng-controller='bTorrentCtrl', ng-cloak='') .row .twelve.columns @@ -46,7 +46,7 @@ html(ng-app='bTorrent', lang='en') tbody(ng-hide='client.torrents.length') tr td.center(colspan='100') Add a torrent o seed a file! - tbody(ng-repeat='torrent in client.torrents', ng-if='torrent.files') + tbody(ng-repeat='torrent in client.torrents', ng-if='torrent.name') tr.torrentRow(ng-class='{selectedTorrent: torrent.showFiles}') td div @@ -57,7 +57,7 @@ html(ng-app='bTorrent', lang='en') | {{torrent.pSize | pbytes}} in a(href='#', onclick='return false;', ng-click='toggleTorrent(torrent)') {{torrent.files.length}} files td(ng-hide='client.done()') - | {{torrent.downloaded | pbytes}} + | {{torrent.downloaded | pbytes}} span.subInfo ({{torrent.pProgress}}%) br span.subInfo @ {{torrent.downloadSpeed() | pbytes}}/s