From c31a3d6e047f1ed7fa9ee44b297db6ab2a0f50ac Mon Sep 17 00:00:00 2001 From: baz Date: Sun, 11 Feb 2024 21:17:21 +0000 Subject: [PATCH] misc updates --- commands/100-games/currentlyplaying.js | 4 +--- databaseHelperFunctions.js | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/commands/100-games/currentlyplaying.js b/commands/100-games/currentlyplaying.js index 437ed52..d3681d1 100644 --- a/commands/100-games/currentlyplaying.js +++ b/commands/100-games/currentlyplaying.js @@ -20,11 +20,9 @@ module.exports = { const userDatabaseEntry = await getUserRegistration(user); if (!userDatabaseEntry) return interaction.followUp({ content: `Issue checking registration with "${user.username}".`, ephemeral: true }); - let databaseEntries = await getPlayingGames(userDatabaseEntry.id); + const databaseEntries = await getPlayingGames(userDatabaseEntry.id); if (!databaseEntries || databaseEntries.length == 0) return interaction.followUp({ content: 'No games found.', ephemeral: true }); - databaseEntries = databaseEntries.reverse(); - let desc = ''; for (let i = 0; i < databaseEntries.length; i++) { diff --git a/databaseHelperFunctions.js b/databaseHelperFunctions.js index 4d086d0..2fd2a51 100644 --- a/databaseHelperFunctions.js +++ b/databaseHelperFunctions.js @@ -91,7 +91,7 @@ async function createPlayingGameEntry(user, game) { entry.status = 'playing'; await entry.save(); - + return entry; } @@ -252,7 +252,7 @@ async function getRecentBeatenGameEntry(userId) { } async function getRecentGameEntry(userId, status) { - const beatenGameEntry = await LoggedGames.findOne({ where: { userId: userId, status: status }, order: [ [ 'updatedAt', 'ASC' ]] }) + const beatenGameEntry = await LoggedGames.findOne({ where: { userId: userId, status: status }, order: [ [ 'updatedAt', 'DESC' ]] }) .catch((err) => { console.log(err); });