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) => {
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) {
res.status(404).send('Apps not found.')
} else {
@@ -63,7 +65,9 @@ export function addGameApis(app, jsonParser) {
app.post('/api/game/:gameId/picks', async (req, res) => {
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) {
res.status(404).send('Picks not found')
} else {

View File

@@ -11,11 +11,11 @@
<div>Last Game: {{ lastPlayedPostDate }}</div>
<div class="d-flex flex-row">
<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>
</div>
<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>
</div>
</div>
@@ -48,7 +48,7 @@ const earnedIP = ref(0)
const gamesPlayedCount = ref(0)
const gamesAppliedCount = ref(0)
const pickRate = ref(0)
const lastPlayedPostDate = ref({})
const lastPlayedPostDate = ref({ played: [], applied: [] })
async function loadCharacterDetails() {
const characterResponse = await axios.get(`/api/character/${characterId.value}`)

View File

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