]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix: Make smooth bitrate and remaining upload time work when unset
authorFerdinand Thiessen <opensource@fthiessen.de>
Wed, 16 Aug 2023 13:09:49 +0000 (15:09 +0200)
committerFerdinand Thiessen <opensource@fthiessen.de>
Sat, 26 Aug 2023 13:03:38 +0000 (15:03 +0200)
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
apps/files/js/file-upload.js

index 7a129a989d11b227fe4f707c3ee725befaf23f24..a4058fd1ad579116fd34e4f9d982481e042a3e59 100644 (file)
@@ -1264,10 +1264,10 @@ OC.Uploader.prototype = _.extend({
                                        }
                                        //console.log('#', ' idx: ',bufferIndex, ' Total: ', bufferTotal, ' remainSeconds: ', remainingSeconds, ' during: ', diffUpdate);
 
-                                       if (smoothRemainingSeconds === null) {
-                                               smoothRemainingSeconds = bufferTotal / bufferSize;
-                                       } else{
+                                       if (smoothRemainingSeconds) {
                                                smoothRemainingSeconds = smoothing * (bufferTotal / bufferSize) + ((1-smoothing) * smoothRemainingSeconds);
+                                       } else {
+                                               smoothRemainingSeconds = bufferTotal / bufferSize;
                                        }
 
                                        if (bufferIndex % 4 === 0) {
@@ -1281,10 +1281,10 @@ OC.Uploader.prototype = _.extend({
                                        }
 
                                        // smooth bitrate
-                                       if (smoothBitrate === null) {
-                                               smoothBitrate = data.bitrate;
-                                       } else{
+                                       if (smoothBitrate) {
                                                smoothBitrate = smoothing * data.bitrate + ((1-smoothing) * smoothBitrate);
+                                       } else {
+                                               smoothBitrate = data.bitrate;
                                        }
  
                                        self._setProgressBarText(h, h, t('files', '{loadedSize} of {totalSize} ({bitrate})' , {