Fix: Backend score parsing (points vs score) and Frontend songselect ID fallback
This commit is contained in:
8
app.py
8
app.py
@@ -789,7 +789,13 @@ def route_api_leaderboard_submit():
|
||||
else:
|
||||
score_obj = score_data
|
||||
|
||||
score_value = int(score_obj.get('score', 0))
|
||||
# Check for 'score' first, then 'points'
|
||||
# Frontend usually sends 'points'
|
||||
score_val = score_obj.get('score')
|
||||
if score_val is None:
|
||||
score_val = score_obj.get('points')
|
||||
|
||||
score_value = int(score_val or 0)
|
||||
except:
|
||||
return api_error('invalid_score_format')
|
||||
|
||||
|
||||
@@ -3335,7 +3335,9 @@ class SongSelect {
|
||||
});
|
||||
}
|
||||
toLeaderboard() {
|
||||
var songId = this.songs[this.selectedSong].id
|
||||
var song = this.songs[this.selectedSong]
|
||||
var songId = song.id || song.hash
|
||||
|
||||
// Allow leaderboard for any song with an ID (numeric or hash)
|
||||
if (!songId) {
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user