changeset 247:7a6ef711c73a

Only emit progress if totalBlockCount is present.
author Lucas Thompson <dev@lucas.im>
date Thu, 27 Apr 2017 10:14:34 +0100
parents 56aa7f48693f
children 4224929943bc
files src/app/services/feature-extraction/feature-extraction.service.ts
diffstat 1 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/app/services/feature-extraction/feature-extraction.service.ts	Wed Apr 26 18:43:05 2017 +0100
+++ b/src/app/services/feature-extraction/feature-extraction.service.ts	Thu Apr 27 10:14:34 2017 +0100
@@ -68,10 +68,12 @@
   extract(analysisItemId: string, request: SimpleRequest): Promise<void> {
     return this.client.collect(request)
       .do(val => {
-        this.progressUpdated.next({
-          id: analysisItemId,
-          value: (val.processedBlockCount / val.totalBlockCount) * 100
-        });
+        if (val.totalBlockCount > 0) {
+          this.progressUpdated.next({
+            id: analysisItemId,
+            value: (val.processedBlockCount / val.totalBlockCount) * 100
+          });
+        }
       })
       .toPromise()
       .then((response) => {