shenanigans
This commit is contained in:
@@ -8,9 +8,11 @@
|
||||
Games Played: {{ gamesPlayedCount }} --- Games Applied: {{ gamesAppliedCount }} -- Pick Rate:
|
||||
{{ pickRate.toFixed(2) }}%
|
||||
</div>
|
||||
<!-- <div>Last Game: {{ new Date(gamesPlayed[gamesPlayed.length - 1].postdate * 1000).toISOString().split('T')[0]}}</div> -->
|
||||
<div>Last Game: {{ lastPlayedPostDate }}</div>
|
||||
<div class="d-flex flex-row">
|
||||
<GameTable title="Games Played" :gameList="games.played"></GameTable>
|
||||
<game-table title="Games Applied" :gameList="games.applied"></game-table>
|
||||
</div>
|
||||
</v-container>
|
||||
</template>
|
||||
|
||||
@@ -32,14 +34,12 @@ const earnedIP = ref(0)
|
||||
const gamesPlayedCount = ref(0)
|
||||
const gamesAppliedCount = ref(0)
|
||||
const pickRate = ref(0)
|
||||
const lastPlayedPostDate = ref({})
|
||||
|
||||
async function loadCharacterDetails() {
|
||||
const characterResponse = await axios.get(`/api/character/${characterId.value}`)
|
||||
const gameDetails = await axios.post(`/api/character/${characterId.value}/gameHistory`)
|
||||
|
||||
console.log(characterResponse)
|
||||
console.log(gameDetails)
|
||||
|
||||
character.value = characterResponse.data
|
||||
games.value = {
|
||||
played: gameDetails.data.characterPickedForGame,
|
||||
@@ -64,7 +64,18 @@ function calculateDerivedGameStats(gamesPlayedList, gamesAppliedList) {
|
||||
pickRate.value = (gamesPlayedList.length / gamesAppliedList.length) * 100
|
||||
}
|
||||
|
||||
function calculateDerivedLastPlayedPostDate(gamesPlayedList) {
|
||||
if (gamesPlayedList.length === 0) {
|
||||
lastPlayedPostDate.value = 'N/A'
|
||||
} else {
|
||||
lastPlayedPostDate.value = new Date(gamesPlayedList[gamesPlayedList.length - 1].postdate * 1000)
|
||||
.toISOString()
|
||||
.split('T')[0]
|
||||
}
|
||||
}
|
||||
|
||||
watch(games, (newValue, oldValue) => {
|
||||
calculateDerivedLastPlayedPostDate(newValue.played)
|
||||
calculateDerivedEarnings(newValue.played)
|
||||
calculateDerivedGameStats(newValue.played, newValue.applied)
|
||||
})
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
<template>
|
||||
<div class="game-title-box">
|
||||
<h1>#{{ game.id }} - {{ game.title }}</h1>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user