Fix new lines

This commit is contained in:
David Markowitz 2023-05-05 21:33:30 -07:00
parent 0faef7d791
commit 3b8f18d2be

View File

@ -64,33 +64,33 @@ bool Leaderboard::GetRankingQuery(std::string& lookupReturn) const {
void Leaderboard::SetupLeaderboard() { void Leaderboard::SetupLeaderboard() {
std::string queryBase = std::string queryBase =
" \ R"QUERY(
WITH leaderboardsRanked AS ( \ WITH leaderboardsRanked AS (
SELECT leaderboard.*, charinfo.name, \ SELECT leaderboard.*, charinfo.name,
RANK() OVER \ RANK() OVER
( \ (
ORDER BY %s \ ORDER BY %s
) AS ranking \ ) AS ranking
FROM leaderboard JOIN charinfo on charinfo.id = leaderboard.character_id \ FROM leaderboard JOIN charinfo on charinfo.id = leaderboard.character_id
WHERE game_id = ? %s \ WHERE game_id = ? %s
), \ ),
myStanding AS ( \ myStanding AS (
SELECT \ SELECT
ranking as myRank \ ranking as myRank
FROM leaderboardsRanked \ FROM leaderboardsRanked
WHERE id = ? \ WHERE id = ?
), \ ),
lowestRanking AS ( \ lowestRanking AS (
SELECT MAX(ranking) AS lowestRank \ SELECT MAX(ranking) AS lowestRank
FROM leaderboardsRanked \ FROM leaderboardsRanked
) \ )
SELECT %s, character_id, UNIX_TIMESTAMP(last_played) as lastPlayed, leaderboardsRanked.name, leaderboardsRanked.ranking FROM leaderboardsRanked, myStanding, lowestRanking \ SELECT %s, character_id, UNIX_TIMESTAMP(last_played) as lastPlayed, leaderboardsRanked.name, leaderboardsRanked.ranking FROM leaderboardsRanked, myStanding, lowestRanking
WHERE leaderboardsRanked.ranking \ WHERE leaderboardsRanked.ranking
BETWEEN \ BETWEEN
LEAST(GREATEST(CAST(myRank AS SIGNED) - 5, 1), lowestRanking.lowestRank - 10) \ LEAST(GREATEST(CAST(myRank AS SIGNED) - 5, 1), lowestRanking.lowestRank - 10)
AND \ AND
LEAST(GREATEST(myRank + 5, 11), lowestRanking.lowestRank) \ LEAST(GREATEST(myRank + 5, 11), lowestRanking.lowestRank)
ORDER BY ranking ASC;"; ORDER BY ranking ASC;)QUERY";
// Setup query based on activity. // Setup query based on activity.
// Where clause will vary based on what query we are doing // Where clause will vary based on what query we are doing
// Get base based on InfoType // Get base based on InfoType