mirror of
https://github.com/vkaelin/LeagueStats.git
synced 2026-03-25 12:57:28 +00:00
fix: calculation of the kda
This commit is contained in:
parent
920b271925
commit
0278b3934c
2 changed files with 16 additions and 2 deletions
|
|
@ -112,6 +112,7 @@
|
|||
>
|
||||
<router-link
|
||||
:to="{ name: 'summoner', params: { region: $route.params.region, name: ally.name }}"
|
||||
:class="isSummonerProfile(ally.name)"
|
||||
class="w-20 text-right overflow-hidden text-overflow whitespace-no-wrap text-sm text-blue-200 font-medium hover:text-blue-100"
|
||||
>{{ ally.name }}</router-link>
|
||||
<div
|
||||
|
|
@ -167,6 +168,14 @@ export default {
|
|||
...mapState({
|
||||
roles: state => state.roles
|
||||
}),
|
||||
},
|
||||
|
||||
methods: {
|
||||
isSummonerProfile(allyName) {
|
||||
return {
|
||||
'font-bold': this.$route.params.name.toLowerCase() === allyName.toLowerCase()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -52,7 +52,12 @@ export function createSummonerData(RiotData, championsInfos, runesInfos) {
|
|||
const kills = player.stats.kills
|
||||
const deaths = player.stats.deaths
|
||||
const assists = player.stats.assists
|
||||
const kda = +(deaths === 0 ? 0 : ((kills + assists) / deaths)).toFixed(2)
|
||||
let kda
|
||||
if (kills + assists !== 0 && deaths === 0) {
|
||||
kda = '∞'
|
||||
} else {
|
||||
kda = +(deaths === 0 ? 0 : ((kills + assists) / deaths)).toFixed(2)
|
||||
}
|
||||
const level = player.stats.champLevel
|
||||
const damage = +(player.stats.totalDamageDealtToChampions / 1000).toFixed(1) + 'k'
|
||||
|
||||
|
|
@ -167,6 +172,6 @@ function getSummonerLink(id) {
|
|||
}
|
||||
|
||||
function sortTeamByRole(a, b) {
|
||||
const sortingArr = [ 'TOP', 'JUNGLE', 'MIDDLE', 'BOTTOM', 'SUPPORT']
|
||||
const sortingArr = ['TOP', 'JUNGLE', 'MIDDLE', 'BOTTOM', 'SUPPORT']
|
||||
return sortingArr.indexOf(a.role) - sortingArr.indexOf(b.role)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue