git sucks

This commit is contained in:
jmosrael@gmail.com
2024-05-26 20:43:10 -07:00
parent 79db675a6a
commit 65378473e0
3 changed files with 12 additions and 6 deletions

View File

@@ -50,7 +50,9 @@ export function addGameApis(app, jsonParser) {
app.post('/api/game/:gameId/apps', async (req, res) => { app.post('/api/game/:gameId/apps', async (req, res) => {
try { try {
const apps = await App.findAll({ where: { gameId: req.params['gameId'] } }) const apps = await App.findAll({
include: { model: Character, as: "appliedCharacter"},
where: { gameId: req.params['gameId'] } })
if (!apps) { if (!apps) {
res.status(404).send('Apps not found.') res.status(404).send('Apps not found.')
} else { } else {
@@ -63,7 +65,9 @@ export function addGameApis(app, jsonParser) {
app.post('/api/game/:gameId/picks', async (req, res) => { app.post('/api/game/:gameId/picks', async (req, res) => {
try { try {
const picks = await Pick.findAll({ where: { gameId: req.params['gameId'] } }) const picks = await Pick.findAll({
include: { model: Character, as: "pickedCharacter"},
where: { gameId: req.params['gameId'] } })
if (!picks) { if (!picks) {
res.status(404).send('Picks not found') res.status(404).send('Picks not found')
} else { } else {

View File

@@ -11,11 +11,11 @@
<div>Last Game: {{ lastPlayedPostDate }}</div> <div>Last Game: {{ lastPlayedPostDate }}</div>
<div class="d-flex flex-row"> <div class="d-flex flex-row">
<div class="flex-column game-list"> <div class="flex-column game-list">
<h3 class="game-list-title">{{ games.played.length }} Games Played</h3> <h3 class="game-list-title">{{ (games.played || []).length }} Games Played</h3>
<GameTable :gameList="games.played"></GameTable> <GameTable :gameList="games.played"></GameTable>
</div> </div>
<div class="flex-column game-list"> <div class="flex-column game-list">
<h3 class="game-list-title">{{ games.applied.length }} Games Applied</h3> <h3 class="game-list-title">{{ (games.applied || []).length }} Games Applied</h3>
<game-table :gameList="games.applied"></game-table> <game-table :gameList="games.applied"></game-table>
</div> </div>
</div> </div>
@@ -48,7 +48,7 @@ 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({}) const lastPlayedPostDate = ref({ played: [], applied: [] })
async function loadCharacterDetails() { async function loadCharacterDetails() {
const characterResponse = await axios.get(`/api/character/${characterId.value}`) const characterResponse = await axios.get(`/api/character/${characterId.value}`)

View File

@@ -112,6 +112,7 @@ watch(
async function loadGameDetails() { async function loadGameDetails() {
const response = await axios.get(`/api/game/${gameId.value}`) const response = await axios.get(`/api/game/${gameId.value}`)
console.log(response)
game.value = response.data game.value = response.data
loadPicks() loadPicks()
loadApps() loadApps()
@@ -119,12 +120,13 @@ async function loadGameDetails() {
async function loadPicks() { async function loadPicks() {
const response = await axios.post(`/api/game/${gameId.value}/picks`) const response = await axios.post(`/api/game/${gameId.value}/picks`)
console.log(response)
picks.value = response.data picks.value = response.data
} }
async function loadApps() { async function loadApps() {
const response = await axios.post(`/api/game/${gameId.value}/apps`) const response = await axios.post(`/api/game/${gameId.value}/apps`)
console.log(response)
apps.value = response.data apps.value = response.data
console.log(apps.value)
} }
</script> </script>