gui, lib/model: Prevent negative sync completion (fixes #4570) (#6248)

This commit is contained in:
Simon Frei
2020-01-03 14:07:57 +01:00
committed by Jakob Borg
parent 7a8e73d599
commit f56a5545d4
2 changed files with 12 additions and 2 deletions

View File

@@ -849,10 +849,15 @@ angular.module('syncthing.core')
if (typeof $scope.model[folder] === 'undefined') {
return 100;
}
if ($scope.model[folder].globalBytes === 0) {
if ($scope.model[folder].needTotalItems === 0) {
return 100;
}
if ($scope.model[folder].needBytes == 0 && $scope.model[folder].needDeletes > 0) {
// We don't need any data, but we have deletes that we need
// to do. Drop down the completion percentage to indicate
// that we have stuff to do.
return 95;
}
var pct = 100 * $scope.model[folder].inSyncBytes / $scope.model[folder].globalBytes;
return Math.floor(pct);
};