Try to fix close issue
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good

This commit is contained in:
Willem Dantuma 2019-07-19 10:01:39 +02:00
parent e4b21306b1
commit 455562aa90

View File

@ -40,10 +40,15 @@ export class ResumableFileUploadService implements OnDestroy{
updatetotalprogress() { updatetotalprogress() {
var totalProgress =0; var totalProgress =0;
var n=0;
for(var i =0;i<this.files.length;i++) { for(var i =0;i<this.files.length;i++) {
if(!this.files[i].error) {
totalProgress+=this.files[i].progress; totalProgress+=this.files[i].progress;
n++;
}
} }
this.totalProgress=totalProgress/this.files.length; this.totalProgress=totalProgress/this.files.length;
if(totalProgress==100) this.isUploading=false;
} }
handleState(state:UploadState) { handleState(state:UploadState) {
@ -57,14 +62,12 @@ export class ResumableFileUploadService implements OnDestroy{
var file =this.files.find((f) => f.identifier == state.uploadId ) var file =this.files.find((f) => f.identifier == state.uploadId )
if(file) { if(file) {
file.progress = (state.progress?state.progress:0); file.progress = (state.progress?state.progress:0);
this.updatetotalprogress();
} }
};break; };break;
case "complete": { case "complete": {
var file =this.files.find((f) => f.identifier == state.uploadId ) var file =this.files.find((f) => f.identifier == state.uploadId )
if(file) { if(file) {
file.progress = (state.progress?state.progress:0); file.progress = (state.progress?state.progress:0);
this.updatetotalprogress();
} }
file.success=true; file.success=true;
};break; };break;
@ -76,6 +79,7 @@ export class ResumableFileUploadService implements OnDestroy{
} }
};break; };break;
} }
this.updatetotalprogress();
this.refresh.next({}); this.refresh.next({});
} }