Fixed NaN showing

This commit is contained in:
Diego Rodríguez 2015-12-01 02:52:10 -05:00
parent 1e3ea24c4e
commit e756500ffc
2 changed files with 9 additions and 4 deletions

View file

@ -94,6 +94,7 @@ app.controller 'bTorrentCtrl', ['$scope','$http','$log','$location', ($scope, $h
return return
$scope.onTorrent = (torrent, isSeed) -> $scope.onTorrent = (torrent, isSeed) ->
if !isSeed
$scope.client.processing = false $scope.client.processing = false
torrent.pSize = torrent.length torrent.pSize = torrent.length
torrent.showFiles = false torrent.showFiles = false
@ -120,6 +121,8 @@ app.controller 'bTorrentCtrl', ['$scope','$http','$log','$location', ($scope, $h
file.getBlobURL (err, url) -> file.getBlobURL (err, url) ->
if err if err
throw err throw err
if isSeed
$scope.client.processing = false
file.url = url file.url = url
if !isSeed if !isSeed
dbg 'Finished downloading file ' + file.name, torrent dbg 'Finished downloading file ' + file.name, torrent
@ -166,6 +169,8 @@ app.filter 'html', ['$sce', ($sce) ->
app.filter 'pbytes', -> app.filter 'pbytes', ->
(num) -> (num) ->
if isNaN(num)
return ''
exponent = undefined exponent = undefined
unit = undefined unit = undefined
neg = num < 0 neg = num < 0

View file

@ -16,7 +16,7 @@ html(ng-app='bTorrent', lang='en')
header header
h1 h1
| βTorrent | βTorrent
span.version v0.5 span.version v0.5.01
.container(ng-controller='bTorrentCtrl', ng-cloak='') .container(ng-controller='bTorrentCtrl', ng-cloak='')
.row .row
.twelve.columns .twelve.columns
@ -46,7 +46,7 @@ html(ng-app='bTorrent', lang='en')
tbody(ng-hide='client.torrents.length') tbody(ng-hide='client.torrents.length')
tr tr
td.center(colspan='100') Add a torrent o seed a file! 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}') tr.torrentRow(ng-class='{selectedTorrent: torrent.showFiles}')
td td
div div