From 9e82ae4f8c47440085a22af44aab94e535784758 Mon Sep 17 00:00:00 2001 From: Madhavtib Date: Wed, 10 Dec 2025 13:21:08 -0500 Subject: [PATCH] Update scoreboard to refresh live scores on the board --- server.py | 3 ++- static/scoreboard.js | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/server.py b/server.py index 372a266c..631a5f12 100644 --- a/server.py +++ b/server.py @@ -50,7 +50,8 @@ def increase_score(): for team in scoreboard: if team["id"] == team_id: team["score"] += 1 - + #reaarange the scoreboard + scoreboard.sort(key=lambda t: t["score"], reverse=True) return jsonify(scoreboard=scoreboard) diff --git a/static/scoreboard.js b/static/scoreboard.js index 34ce2009..7dac22f8 100644 --- a/static/scoreboard.js +++ b/static/scoreboard.js @@ -32,7 +32,8 @@ function increase_score(id){ contentType: "application/json; charset=utf-8", data : JSON.stringify(team_id), success: function(result){ - + scoreboard = result['scoreboard']; + display_scoreboard(scoreboard); }, error: function(request, status, error){ console.log("Error");