From ccfee4f8c0eba5c7910b659ade615e42ce2e4157 Mon Sep 17 00:00:00 2001 From: baz Date: Sat, 13 Jul 2024 17:17:36 +0100 Subject: [PATCH] Update databaseHelperFunctions to use statusLastChanged --- databaseHelperFunctions.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/databaseHelperFunctions.js b/databaseHelperFunctions.js index 5f2284a..8bd95aa 100644 --- a/databaseHelperFunctions.js +++ b/databaseHelperFunctions.js @@ -284,7 +284,7 @@ async function getRecentBeatenGameEntry(userId) { } async function getRecentGameEntry(userId, status) { - const beatenGameEntry = await LoggedGames.findOne({ where: { userId: userId, status: status }, order: [ [ 'updatedAt', 'DESC' ]] }) + const beatenGameEntry = await LoggedGames.findOne({ where: { userId: userId, status: status }, order: [ [ 'statusLastChanged', 'DESC' ]] }) .catch((err) => { console.log(err); }); @@ -302,7 +302,7 @@ async function getRecentGameEntry(userId, status) { } async function getRecentEntry(userId) { - const beatenGameEntry = await LoggedGames.findOne({ where: { userId: userId }, order: [ [ 'updatedAt', 'DESC' ]] }) + const beatenGameEntry = await LoggedGames.findOne({ where: { userId: userId }, order: [ [ 'statusLastChanged', 'DESC' ]] }) .catch((err) => { console.log(err); }); @@ -325,7 +325,7 @@ async function getBeatenGames(id) { } async function getGames(id, status) { - const gameEntries = await LoggedGames.findAll({ where: { userId: id, status: status }, order: [ [ 'updatedAt', 'ASC' ]] }) + const gameEntries = await LoggedGames.findAll({ where: { userId: id, status: status }, order: [ [ 'statusLastChanged', 'ASC' ]] }) .catch((err) => { console.log(err); }); @@ -336,7 +336,7 @@ async function getGames(id, status) { } async function getAllBeatenGames() { - const gameEntries = await LoggedGames.findAll({ where: { status: 'beat' }, order: [ [ 'updatedAt', 'ASC' ]] }) + const gameEntries = await LoggedGames.findAll({ where: { status: 'beat' }, order: [ [ 'statusLastChanged', 'ASC' ]] }) .catch((err) => { console.log(err); });