Fix percentage bug
This commit is contained in:
@@ -18,7 +18,7 @@ async function itemList() {
|
|||||||
function arrayRemovePercentage(array: Array<{count:number}>, totalGames:number, percentage: number) {
|
function arrayRemovePercentage(array: Array<{count:number}>, totalGames:number, percentage: number) {
|
||||||
let toRemove : Array<{count:number}> = []
|
let toRemove : Array<{count:number}> = []
|
||||||
for(let item of array) {
|
for(let item of array) {
|
||||||
if((item.count/totalGames) < 0.05) {
|
if((item.count/totalGames) < percentage) {
|
||||||
toRemove.push(item)
|
toRemove.push(item)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -175,8 +175,8 @@ async function championInfos(client, patch: number, champion: Champion) {
|
|||||||
|
|
||||||
let totalChampionMatches = winningMatches + losingMatches;
|
let totalChampionMatches = winningMatches + losingMatches;
|
||||||
|
|
||||||
|
arrayRemovePercentage(lanes, totalChampionMatches, 0.2)
|
||||||
lanes.sort((a, b) => b.count - a.count)
|
lanes.sort((a, b) => b.count - a.count)
|
||||||
arrayRemovePercentage(lanes, totalChampionMatches, 0.15)
|
|
||||||
|
|
||||||
// Filter runes to keep 3 most played
|
// Filter runes to keep 3 most played
|
||||||
runes.sort((a, b) => b.count - a.count)
|
runes.sort((a, b) => b.count - a.count)
|
||||||
|
|||||||
Reference in New Issue
Block a user