From dbe4fbc19ea0bff3bd9c1918b6d4f9d171367074 Mon Sep 17 00:00:00 2001 From: Jennifer Taylor Date: Wed, 1 Oct 2025 01:08:22 +0000 Subject: [PATCH] Add kcal display for songs on records/topscores. --- bemani/frontend/danevo/danevo.py | 1 + bemani/frontend/danevo/endpoints.py | 4 ++++ .../static/controllers/danevo/records.react.js | 18 +++++++++++++----- .../controllers/danevo/topscores.react.js | 2 +- 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/bemani/frontend/danevo/danevo.py b/bemani/frontend/danevo/danevo.py index 0f247ef..24ebf5e 100644 --- a/bemani/frontend/danevo/danevo.py +++ b/bemani/frontend/danevo/danevo.py @@ -76,6 +76,7 @@ class DanceEvolutionFrontend(FrontendBase): formatted_song["levels"] = levels formatted_song["bpm_min"] = song.data.get_int("bpm_min") formatted_song["bpm_max"] = song.data.get_int("bpm_max") + formatted_song["kcal"] = song.data.get_float("kcal") return formatted_song def merge_song(self, existing: Dict[str, Any], new: Song) -> Dict[str, Any]: diff --git a/bemani/frontend/danevo/endpoints.py b/bemani/frontend/danevo/endpoints.py index edea869..2d17f80 100644 --- a/bemani/frontend/danevo/endpoints.py +++ b/bemani/frontend/danevo/endpoints.py @@ -107,6 +107,7 @@ def viewtopscores(musicid: int) -> Response: name = None artist = None genre = None + kcal = None levels = [0, 0, 0, 0, 0] for version in versions: @@ -119,6 +120,8 @@ def viewtopscores(musicid: int) -> Response: artist = details.artist if genre is None: genre = details.genre + if kcal is None: + kcal = details.data.get_float("kcal") if levels[chart] == 0: levels[chart] = details.data.get_int("level") @@ -136,6 +139,7 @@ def viewtopscores(musicid: int) -> Response: "artist": artist, "genre": genre, "levels": levels, + "kcal": kcal, "players": top_scores["players"], "topscores": top_scores["topscores"], }, diff --git a/bemani/frontend/static/controllers/danevo/records.react.js b/bemani/frontend/static/controllers/danevo/records.react.js index 5f3a05c..344251a 100644 --- a/bemani/frontend/static/controllers/danevo/records.react.js +++ b/bemani/frontend/static/controllers/danevo/records.react.js @@ -110,11 +110,19 @@ var network_records = createReactClass({ ); }, - renderLevel: function(songid, chart) { - if (this.state.songs[songid].levels[chart] == 0) { + renderLevel: function(songid) { + if (this.state.songs[songid].levels[0] == 0) { return --; } else { - return {this.state.songs[songid].levels[chart]}; + return {this.state.songs[songid].levels[0]}; + } + }, + + renderKcal: function(songid) { + if (this.state.songs[songid].kcal <= 0.0) { + return --; + } else { + return {this.state.songs[songid].kcal}; } }, @@ -180,7 +188,7 @@ var network_records = createReactClass({
- Level {this.renderLevel(songid, 0)} + level {this.renderLevel(songid)} / {this.renderKcal(songid)} kcal
0 ? "" : "nochart"}> @@ -410,7 +418,7 @@ var network_records = createReactClass({
- Level {this.renderLevel(songid, 0)} + level {this.renderLevel(songid)} / {this.renderKcal(songid)} kcal
{ showplays ?
#{index + 1} - {plays}{plays == 1 ? ' play' : ' plays'}
: null } diff --git a/bemani/frontend/static/controllers/danevo/topscores.react.js b/bemani/frontend/static/controllers/danevo/topscores.react.js index 0988343..2b15886 100644 --- a/bemani/frontend/static/controllers/danevo/topscores.react.js +++ b/bemani/frontend/static/controllers/danevo/topscores.react.js @@ -71,7 +71,7 @@ var top_scores = createReactClass({
{window.name}
{window.artist}
{window.genre}
-
Level {window.levels[chart]}
+
level {window.levels[chart]} / {window.kcal} kcal
{valid_charts.map(function(chart) {