From 06892f0a845ed3253d36ce32c3f4238efdc59af2 Mon Sep 17 00:00:00 2001 From: "Ruben Hartenstein (PEA4-Fe)" Date: Thu, 11 Mar 2021 22:20:58 +0100 Subject: [PATCH] More efficient sample counting --- src/app/home/home.component.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/app/home/home.component.ts b/src/app/home/home.component.ts index 16ee885..52d5069 100644 --- a/src/app/home/home.component.ts +++ b/src/app/home/home.component.ts @@ -74,10 +74,12 @@ export class HomeComponent implements OnInit { countSamples(data: any) { this.keys.map(key => key.count = 0); for (var i = 0; i < data.length; i++) { - this.keys.forEach(key => { + this.keys.every(key => { if (key.id === data[i].material.group) { - key.count += 1; + key.count++; + return false; } + return true; }); } this.updateGraph();