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,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

View file

@ -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