changeset 242:ca5fcdfa0851

Remove the reducing, assuming the server will return all features when it completes, still emit progress whenever a response is received.
author Lucas Thompson <dev@lucas.im>
date Wed, 26 Apr 2017 16:14:25 +0100
parents 9285f1b80990
children 7106cdd59e62
files src/app/services/feature-extraction/feature-extraction.service.ts
diffstat 1 files changed, 0 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/src/app/services/feature-extraction/feature-extraction.service.ts	Wed Apr 26 16:13:15 2017 +0100
+++ b/src/app/services/feature-extraction/feature-extraction.service.ts	Wed Apr 26 16:14:25 2017 +0100
@@ -66,14 +66,6 @@
   }
 
   extract(analysisItemId: string, request: SimpleRequest): Promise<void> {
-    const arrayReducer = (acc, val) => {
-      acc.push.apply(acc, val);
-      return acc;
-    };
-    const typedArrayReducer = (acc: Float32Array,
-                               val: Float32Array): Float32Array => {
-      return Float32Array.of(...acc, ...val);
-    };
     return this.client.collect(request)
       .do(val => {
         this.progressUpdated.next({
@@ -81,24 +73,6 @@
           value: (val.processedBlockCount / val.totalBlockCount) * 100
         });
       })
-      .reduce((acc, val) => {
-        if (acc.features.data instanceof Array &&
-          val.features.data instanceof Array) {
-          acc.features.data = arrayReducer(
-            acc.features.data,
-            val.features.data
-          );
-        } else if (acc.features.data instanceof Float32Array &&
-          val.features.data instanceof Float32Array) {
-          acc.features.data = typedArrayReducer(
-            acc.features.data,
-            val.features.data
-          );
-        } else {
-          throw new Error('Invalid feature output. Aborting');
-        }
-        return acc;
-      })
       .toPromise()
       .then((response) => {
         this.featuresExtracted.next(response);