undefined bug fix

This commit is contained in:
Drew Ansbacher
2021-09-08 16:14:44 +03:00
committed by Aiden McClelland
parent d809e175db
commit b3a4ebcf53
3 changed files with 4 additions and 3 deletions

View File

@@ -73,7 +73,7 @@ export class AppListPage {
},
statusRendering: renderPkgStatus(pkgs[id].state, pkgs[id].installed?.status),
sub: null,
installProgress: this.installPackageService.transform(pkgs[id]['install-progress']),
installProgress: !isEmptyObject(pkgs[id]['install-progress']) ? this.installPackageService.transform(pkgs[id]['install-progress']) : undefined,
}
// subscribe to pkg
this.pkgs[id].sub = this.patch.watch$('package-data', id).subscribe(pkg => {

View File

@@ -62,7 +62,8 @@ export class AppShowPage {
this.patch.watch$('package-data', this.pkgId)
.subscribe(pkg => {
this.pkg = pkg
this.installProgress = this.packageLoadingService.transform(this.pkg['install-progress'])
console.log('isnt empty', !isEmptyObject(pkg['install-progress']))
this.installProgress = !isEmptyObject(pkg['install-progress']) ? this.packageLoadingService.transform(pkg['install-progress']) : undefined
this.rendering = renderPkgStatus(pkg.state, pkg.installed?.status)
this.mainStatus = { ...pkg.installed?.status.main }
}),

View File

@@ -23,7 +23,7 @@ export class PackageLoadingService {
validateWeight * validated +
unpackWeight * unpacked)
const denominator = Math.floor(loadData.size * (downloadWeight + validateWeight + unpackWeight))
const denominator = Math.floor(size * (downloadWeight + validateWeight + unpackWeight))
return {
totalProgress: Math.round(100 * numerator / denominator),