More efficient sample counting

This commit is contained in:
Ruben Hartenstein (PEA4-Fe) 2021-03-11 22:20:58 +01:00
parent 014ddcc2d7
commit 06892f0a84

View File

@ -74,10 +74,12 @@ export class HomeComponent implements OnInit {
countSamples(data: any) { countSamples(data: any) {
this.keys.map(key => key.count = 0); this.keys.map(key => key.count = 0);
for (var i = 0; i < data.length; i++) { for (var i = 0; i < data.length; i++) {
this.keys.forEach(key => { this.keys.every(key => {
if (key.id === data[i].material.group) { if (key.id === data[i].material.group) {
key.count += 1; key.count++;
return false;
} }
return true;
}); });
} }
this.updateGraph(); this.updateGraph();