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