From ccce77ee428e9962156590c23196c5b77754447b Mon Sep 17 00:00:00 2001 From: Simon Eisenmann Date: Tue, 8 Apr 2014 12:31:16 +0200 Subject: [PATCH] Fixed file download ending prematurely on slow connections. --- static/js/services/filedownload.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/static/js/services/filedownload.js b/static/js/services/filedownload.js index 05788104..0965d09a 100644 --- a/static/js/services/filedownload.js +++ b/static/js/services/filedownload.js @@ -180,12 +180,12 @@ define(["jquery", "underscore"], function($, _) { Session.prototype.done = function(job) { - console.log("Job done", job); + console.log("Job done", job, this.end, this.chunk); var idx = this.jobs.indexOf(job); if (~idx) { this.jobs.splice(idx, 1); }; - if (this.chunk >= this.end) { + if (this.chunk >= this.end && this.jobs.length === 0) { //console.log("File done.") safeApply(this.scope, _.bind(function($scope) { $scope.$emit("downloadComplete");