aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSarthikaDhawan <sarthika15170@iiitd.ac.in>2017-03-06 16:38:35 +0530
committerRoeland Jago Douma <roeland@famdouma.nl>2017-04-04 08:51:20 +0200
commit62fb3bb3ef5f85317dcd6e06f55ef36e3a929640 (patch)
treed6617111cc31d90c7bdf08280c4b542b6f89d7ef
parentec5377306d8824ab7f7e9e0f534c8fb9c2b81a65 (diff)
downloadnextcloud-server-62fb3bb3ef5f85317dcd6e06f55ef36e3a929640.tar.gz
nextcloud-server-62fb3bb3ef5f85317dcd6e06f55ef36e3a929640.zip
file-upload.js modified : Remaining upload time corrected
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
-rwxr-xr-x[-rw-r--r--]apps/files/js/file-upload.js11
1 files changed, 10 insertions, 1 deletions
diff --git a/apps/files/js/file-upload.js b/apps/files/js/file-upload.js
index ad4d03a1bdb..c7e2329eabc 100644..100755
--- a/apps/files/js/file-upload.js
+++ b/apps/files/js/file-upload.js
@@ -960,6 +960,7 @@ OC.Uploader.prototype = _.extend({
var bufferSize = 20;
var buffer = [];
var bufferIndex = 0;
+ var bufferIndex2 = 0;
var bufferTotal = 0;
for(var i = 0; i < bufferSize;i++){
buffer[i] = 0;
@@ -1005,8 +1006,16 @@ OC.Uploader.prototype = _.extend({
bufferTotal = bufferTotal - (buffer[bufferIndex]) + remainingSeconds;
buffer[bufferIndex] = remainingSeconds; //buffer to make it smoother
bufferIndex = (bufferIndex + 1) % bufferSize;
+ bufferIndex2 = bufferIndex2++;
}
- var smoothRemainingSeconds = (bufferTotal / bufferSize); //seconds
+ var smoothRemainingSeconds;
+ if(bufferIndex2<20) {
+ smoothRemainingSeconds = bufferTotal / bufferIndex2;
+ }
+ else {
+ smoothRemainingSeconds = bufferTotal / bufferSize;
+ }
+
var h = moment.duration(smoothRemainingSeconds, "seconds").humanize();
$('#uploadprogressbar .label .mobile').text(h);
$('#uploadprogressbar .label .desktop').text(h);