Fix percentage bug
All checks were successful
pipeline / build-and-push-images (push) Successful in 11s
pipeline / deploy (push) Successful in 7s

This commit is contained in:
2024-11-27 21:20:25 +01:00
parent 43968e4cf1
commit b657f3bb88

View File

@@ -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)