From 83caecbe30cb70aff59425e96d4acb0a3902a6b1 Mon Sep 17 00:00:00 2001 From: David Markowitz Date: Tue, 3 Dec 2024 23:01:10 -0800 Subject: [PATCH] Update Leaderboard.cpp --- dDatabase/GameDatabase/MySQL/Tables/Leaderboard.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/dDatabase/GameDatabase/MySQL/Tables/Leaderboard.cpp b/dDatabase/GameDatabase/MySQL/Tables/Leaderboard.cpp index ee9a7bfd..949de9c9 100644 --- a/dDatabase/GameDatabase/MySQL/Tables/Leaderboard.cpp +++ b/dDatabase/GameDatabase/MySQL/Tables/Leaderboard.cpp @@ -28,7 +28,7 @@ std::vector ProcessQuery(UniqueResultSet& rows) { entry.tertiaryScore = rows->getUInt("tertiaryScore"); entry.numWins = rows->getUInt("numWins"); entry.numTimesPlayed = rows->getUInt("timesPlayed"); - entry.name = rows->getString("ci.name"); + entry.name = rows->getString("char_name"); // entry.ranking is never set because its calculated in leaderboard in code. } @@ -36,20 +36,20 @@ std::vector ProcessQuery(UniqueResultSet& rows) { } std::vector MySQLDatabase::GetDefaultLeaderboard(const uint32_t activityId) { - auto leaderboard = ExecuteSelect("SELECT *, UNIX_TIMESTAMP(last_played) as lp_unix FROM leaderboard lb JOIN charinfo ci on ci.id = lb.character_id where game_id = ? ORDER BY primaryscore DESC, secondaryscore DESC, tertiaryScore DESC, last_played ASC;", activityId); + auto leaderboard = ExecuteSelect("SELECT *, UNIX_TIMESTAMP(last_played) as lp_unix, ci.name as char_name FROM leaderboard lb JOIN charinfo ci on ci.id = lb.character_id where game_id = ? ORDER BY primaryscore DESC, secondaryscore DESC, tertiaryScore DESC, last_played ASC;", activityId); return ProcessQuery(leaderboard); } std::vector MySQLDatabase::GetAgsLeaderboard(const uint32_t activityId) { auto query = Game::config->GetValue("classic_survival_scoring") == "1" ? - "SELECT *, UNIX_TIMESTAMP(last_played) as lp_unix FROM leaderboard lb JOIN charinfo ci on ci.id = lb.character_id where game_id = ? ORDER BY primaryscore DESC, secondaryscore DESC, tertiaryScore DESC, last_played ASC;" : - "SELECT *, UNIX_TIMESTAMP(last_played) as lp_unix FROM leaderboard lb JOIN charinfo ci on ci.id = lb.character_id where game_id = ? ORDER BY secondaryscore DESC, primaryscore DESC, tertiaryScore DESC, last_played ASC;"; + "SELECT *, UNIX_TIMESTAMP(last_played) as lp_unix, ci.name as char_name FROM leaderboard lb JOIN charinfo ci on ci.id = lb.character_id where game_id = ? ORDER BY primaryscore DESC, secondaryscore DESC, tertiaryScore DESC, last_played ASC;" : + "SELECT *, UNIX_TIMESTAMP(last_played) as lp_unix, ci.name as char_name FROM leaderboard lb JOIN charinfo ci on ci.id = lb.character_id where game_id = ? ORDER BY secondaryscore DESC, primaryscore DESC, tertiaryScore DESC, last_played ASC;"; auto leaderboard = ExecuteSelect(query, activityId); return ProcessQuery(leaderboard); } std::vector MySQLDatabase::GetNsLeaderboard(const uint32_t activityId) { - auto leaderboard = ExecuteSelect("SELECT *, UNIX_TIMESTAMP(last_played) as lp_unix FROM leaderboard lb JOIN charinfo ci on ci.id = lb.character_id where game_id = ? ORDER BY primaryscore ASC, secondaryscore DESC, tertiaryScore ASC, last_played ASC;", activityId); + auto leaderboard = ExecuteSelect("SELECT *, UNIX_TIMESTAMP(last_played) as lp_unix, ci.name as char_name FROM leaderboard lb JOIN charinfo ci on ci.id = lb.character_id where game_id = ? ORDER BY primaryscore ASC, secondaryscore DESC, tertiaryScore ASC, last_played ASC;", activityId); return ProcessQuery(leaderboard); }