Show score for loved maps on relax rather than PP
This commit is contained in:
parent
c0217e6339
commit
e06436abb9
|
@ -60,7 +60,6 @@ class handler(requestsManager.asyncRequestHandler):
|
||||||
if username != replayData["uname"]:
|
if username != replayData["uname"]:
|
||||||
userUtils.incrementReplaysWatched(replayData["userid"], replayData["play_mode"], s.mods)
|
userUtils.incrementReplaysWatched(replayData["userid"], replayData["play_mode"], s.mods)
|
||||||
|
|
||||||
|
|
||||||
log.info("Serving replay_{}.osr".format(replayID))
|
log.info("Serving replay_{}.osr".format(replayID))
|
||||||
fileName = ".data/replays/replay_{}.osr".format(replayID)
|
fileName = ".data/replays/replay_{}.osr".format(replayID)
|
||||||
if os.path.isfile(fileName):
|
if os.path.isfile(fileName):
|
||||||
|
|
|
@ -23,7 +23,7 @@ def printServerStartHeader(asciiArt):
|
||||||
|
|
||||||
printColored("> Welcome to the Latest Essential Tatoe Server v{}".format(glob.VERSION), bcolors.GREEN)
|
printColored("> Welcome to the Latest Essential Tatoe Server v{}".format(glob.VERSION), bcolors.GREEN)
|
||||||
printColored("> Made by the Ripple and Akatsuki teams", bcolors.GREEN)
|
printColored("> Made by the Ripple and Akatsuki teams", bcolors.GREEN)
|
||||||
printColored("> {}https://github.com/cmyui/lets".format(bcolors.UNDERLINE), bcolors.GREEN)
|
printColored("> {}https://github.com/osuAkatsuki/lets".format(bcolors.UNDERLINE), bcolors.GREEN)
|
||||||
printColored("> Press CTRL+C to exit\n", bcolors.GREEN)
|
printColored("> Press CTRL+C to exit\n", bcolors.GREEN)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,11 @@ class scoreboard:
|
||||||
friends = ""
|
friends = ""
|
||||||
|
|
||||||
# Sort and limit at the end
|
# Sort and limit at the end
|
||||||
order = "ORDER BY pp DESC"
|
if self.beatmap.rankedStatus == rankedStatuses.LOVED:
|
||||||
|
order = "ORDER BY score DESC"
|
||||||
|
else:
|
||||||
|
order = "ORDER BY pp DESC"
|
||||||
|
|
||||||
limit = "LIMIT 1"
|
limit = "LIMIT 1"
|
||||||
|
|
||||||
# Build query, get params and run query
|
# Build query, get params and run query
|
||||||
|
@ -116,7 +120,10 @@ class scoreboard:
|
||||||
else:
|
else:
|
||||||
friends = ""
|
friends = ""
|
||||||
|
|
||||||
order = "ORDER BY pp DESC"
|
if self.beatmap.rankedStatus == rankedStatuses.LOVED:
|
||||||
|
order = "ORDER BY score DESC"
|
||||||
|
else:
|
||||||
|
order = "ORDER BY pp DESC"
|
||||||
|
|
||||||
if isPremium: # Premium members can see up to 100 scores on leaderboards
|
if isPremium: # Premium members can see up to 100 scores on leaderboards
|
||||||
limit = "LIMIT 100"
|
limit = "LIMIT 100"
|
||||||
|
@ -199,9 +206,9 @@ class scoreboard:
|
||||||
|
|
||||||
# We have a score, run the huge query
|
# We have a score, run the huge query
|
||||||
# Base query
|
# Base query
|
||||||
query = """SELECT COUNT(*) AS rank FROM scores_relax STRAIGHT_JOIN users ON scores_relax.userid = users.id STRAIGHT_JOIN users_stats ON users.id = users_stats.id WHERE scores_relax.pp >= (
|
query = """SELECT COUNT(*) AS rank FROM scores_relax STRAIGHT_JOIN users ON scores_relax.userid = users.id STRAIGHT_JOIN users_stats ON users.id = users_stats.id WHERE scores_relax.{PPorScore} >= (
|
||||||
SELECT pp FROM scores_relax WHERE beatmap_md5 = %(md5)s AND play_mode = %(mode)s AND completed = 3 AND userid = %(userid)s LIMIT 1
|
SELECT {PPorScore} FROM scores_relax WHERE beatmap_md5 = %(md5)s AND play_mode = %(mode)s AND completed = 3 AND userid = %(userid)s LIMIT 1
|
||||||
) AND scores_relax.beatmap_md5 = %(md5)s AND scores_relax.play_mode = %(mode)s AND scores_relax.completed = 3 AND users.privileges & 1 > 0"""
|
) AND scores_relax.beatmap_md5 = %(md5)s AND scores_relax.play_mode = %(mode)s AND scores_relax.completed = 3 AND users.privileges & 1 > 0""".format(PPorScore="score" if self.beatmap.rankedStatus == rankedStatuses.LOVED else "pp")
|
||||||
# Country
|
# Country
|
||||||
if self.country:
|
if self.country:
|
||||||
query += " AND users_stats.country = (SELECT country FROM users_stats WHERE id = %(userid)s LIMIT 1)"
|
query += " AND users_stats.country = (SELECT country FROM users_stats WHERE id = %(userid)s LIMIT 1)"
|
||||||
|
@ -212,7 +219,12 @@ class scoreboard:
|
||||||
if self.friends:
|
if self.friends:
|
||||||
query += " AND (scores_relax.userid IN (SELECT user2 FROM users_relationships WHERE user1 = %(userid)s) OR scores_relax.userid = %(userid)s)"
|
query += " AND (scores_relax.userid IN (SELECT user2 FROM users_relationships WHERE user1 = %(userid)s) OR scores_relax.userid = %(userid)s)"
|
||||||
# Sort and limit at the end
|
# Sort and limit at the end
|
||||||
query += " ORDER BY pp DESC LIMIT 1"
|
|
||||||
|
if self.beatmap.rankedStatus == rankedStatuses.LOVED:
|
||||||
|
query += " ORDER BY score DESC LIMIT 1"
|
||||||
|
else:
|
||||||
|
query += " ORDER BY pp DESC LIMIT 1"
|
||||||
|
|
||||||
result = glob.db.fetch(query, {"md5": self.beatmap.fileMD5, "userid": self.userID, "mode": self.gameMode, "mods": self.mods})
|
result = glob.db.fetch(query, {"md5": self.beatmap.fileMD5, "userid": self.userID, "mode": self.gameMode, "mods": self.mods})
|
||||||
if result is not None:
|
if result is not None:
|
||||||
self.personalBestRank = result["rank"]
|
self.personalBestRank = result["rank"]
|
||||||
|
@ -237,5 +249,5 @@ class scoreboard:
|
||||||
|
|
||||||
# Output top 50 scores
|
# Output top 50 scores
|
||||||
for i in self.scores[1:]:
|
for i in self.scores[1:]:
|
||||||
data += i.getData(pp=1)
|
data += i.getData(pp=self.beatmap.rankedStatus != rankedStatuses.LOVED)
|
||||||
return data
|
return data
|
||||||
|
|
|
@ -29,7 +29,6 @@ class scoreboard:
|
||||||
if setScores:
|
if setScores:
|
||||||
self.setScores()
|
self.setScores()
|
||||||
|
|
||||||
|
|
||||||
def setScores(self):
|
def setScores(self):
|
||||||
"""
|
"""
|
||||||
Set scores list
|
Set scores list
|
||||||
|
|
Reference in New Issue
Block a user