diff options
Diffstat (limited to 'module/web/static/js/models')
-rw-r--r-- | module/web/static/js/models/Package.js | 7 | ||||
-rw-r--r-- | module/web/static/js/models/Progress.js | 5 |
2 files changed, 8 insertions, 4 deletions
diff --git a/module/web/static/js/models/Package.js b/module/web/static/js/models/Package.js index 0b9efca10..1b050d735 100644 --- a/module/web/static/js/models/Package.js +++ b/module/web/static/js/models/Package.js @@ -32,6 +32,13 @@ define(['jquery', 'backbone', 'underscore', 'app', 'collections/FileList', 'requ initialize: function() { }, + toJSON: function(options) { + var obj = Backbone.Model.prototype.toJSON.call(this, options); + obj.percent = Math.round(obj.stats.linksdone * 100 / obj.stats.linkstotal); + + return obj; + }, + // Changes url + method and delegates call to super class fetch: function(options) { options = App.apiRequest( diff --git a/module/web/static/js/models/Progress.js b/module/web/static/js/models/Progress.js index 87e7b350b..96beb0198 100644 --- a/module/web/static/js/models/Progress.js +++ b/module/web/static/js/models/Progress.js @@ -35,10 +35,7 @@ define(['jquery', 'backbone', 'underscore', 'utils/apitypes'], function($, Backb toJSON: function(options) { var obj = Backbone.Model.prototype.toJSON.call(this, options); obj.percent = this.getPercent(); - if (this.isDownload() && this.get('download').status === Api.DownloadStatus.Downloading) - obj.downloading = true; - else - obj.downloading = false; + obj.downloading = this.isDownload() && this.get('download').status === Api.DownloadStatus.Downloading; return obj; }, |