From b657f3bb8822af55c7f36b0ddf4231ff2e86e060 Mon Sep 17 00:00:00 2001 From: vhaudiquet Date: Wed, 27 Nov 2024 21:20:25 +0100 Subject: [PATCH] Fix percentage bug --- match_collector/champion_stat.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/match_collector/champion_stat.ts b/match_collector/champion_stat.ts index b1bad4e..8b0c866 100644 --- a/match_collector/champion_stat.ts +++ b/match_collector/champion_stat.ts @@ -18,7 +18,7 @@ async function itemList() { function arrayRemovePercentage(array: Array<{count:number}>, totalGames:number, percentage: number) { let toRemove : Array<{count:number}> = [] for(let item of array) { - if((item.count/totalGames) < 0.05) { + if((item.count/totalGames) < percentage) { toRemove.push(item) } } @@ -175,8 +175,8 @@ async function championInfos(client, patch: number, champion: Champion) { let totalChampionMatches = winningMatches + losingMatches; + arrayRemovePercentage(lanes, totalChampionMatches, 0.2) lanes.sort((a, b) => b.count - a.count) - arrayRemovePercentage(lanes, totalChampionMatches, 0.15) // Filter runes to keep 3 most played runes.sort((a, b) => b.count - a.count)