add AND filter functionality
parent
2daefe0e6c
commit
a18bedbc48
|
@ -96,8 +96,16 @@ export class StatisticHighScoreComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
private filterPlayerAttribute(attribute) {
|
private filterPlayerAttribute(attribute) {
|
||||||
const query = this.searchTerm.value.toLowerCase();
|
const query = this.searchTerm.value.toLowerCase().split('&');
|
||||||
return this.playersStored[attribute].filter(p => p.name.toLowerCase().includes(query))
|
|
||||||
|
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;
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue