From a18bedbc4880d847d6d8d425bf493d91dcaa3165 Mon Sep 17 00:00:00 2001 From: Florian Hartwich Date: Wed, 27 Dec 2017 12:50:22 +0100 Subject: [PATCH] add AND filter functionality --- .../app/statistic/highscore/highscore.component.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/static/src/app/statistic/highscore/highscore.component.ts b/static/src/app/statistic/highscore/highscore.component.ts index 880c9f2..2f6a1a1 100644 --- a/static/src/app/statistic/highscore/highscore.component.ts +++ b/static/src/app/statistic/highscore/highscore.component.ts @@ -96,8 +96,16 @@ export class StatisticHighScoreComponent { } private filterPlayerAttribute(attribute) { - const query = this.searchTerm.value.toLowerCase(); - return this.playersStored[attribute].filter(p => p.name.toLowerCase().includes(query)) + const query = this.searchTerm.value.toLowerCase().split('&'); + + return this.playersStored[attribute].filter(player => { + for (let i = 0; i < query.length; i++) { + if (player.name.toLowerCase().includes(query[i].trim())) { + return true; + } + } + return false; + }) } }