mirror of
https://github.com/vkaelin/LeagueStats.git
synced 2026-03-25 12:57:28 +00:00
fix: NaN kda for champions stats
This commit is contained in:
parent
eb40fb11af
commit
5b59f5b4cc
2 changed files with 5 additions and 1 deletions
|
|
@ -271,11 +271,12 @@ export default {
|
||||||
},
|
},
|
||||||
updateChampionsList() {
|
updateChampionsList() {
|
||||||
this.championsFull = this.champions.map((champ, index) => {
|
this.championsFull = this.champions.map((champ, index) => {
|
||||||
|
let kda = champ.kills === 0 && champ.assists === 0 && champ.deaths === 0 ? 0 : (champ.kills + champ.assists) / champ.deaths
|
||||||
return {
|
return {
|
||||||
...champ,
|
...champ,
|
||||||
winrate: champ.wins * 100 / champ.count,
|
winrate: champ.wins * 100 / champ.count,
|
||||||
playrate: champ.count * 100 / this.totalGames,
|
playrate: champ.count * 100 / this.totalGames,
|
||||||
kda: (champ.kills + champ.assists) / champ.deaths,
|
kda,
|
||||||
index,
|
index,
|
||||||
lastPlayed: timeDifference(champ.date),
|
lastPlayed: timeDifference(champ.date),
|
||||||
show: true
|
show: true
|
||||||
|
|
|
||||||
|
|
@ -111,6 +111,9 @@ export default {
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
kda(kills, deaths, assists) {
|
kda(kills, deaths, assists) {
|
||||||
|
if (kills === 0 && deaths === 0 && assists === 0) {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
return this.$options.filters.round((kills + assists) / deaths)
|
return this.$options.filters.round((kills + assists) / deaths)
|
||||||
},
|
},
|
||||||
widthBar(value, total) {
|
widthBar(value, total) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue