From e2724cd2b05a51f96ef5294384f6b50f88231e41 Mon Sep 17 00:00:00 2001 From: Alua Zhanuzakova Date: Tue, 19 May 2026 15:38:46 -0400 Subject: [PATCH] az2879 completed coding challenge --- server.py | 2 ++ static/scoreboard.js | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/server.py b/server.py index 372a266c..bd97990d 100644 --- a/server.py +++ b/server.py @@ -51,6 +51,8 @@ def increase_score(): if team["id"] == team_id: team["score"] += 1 + # sort the scoreboard by score + scoreboard.sort(key=lambda x: x["score"], reverse=True) return jsonify(scoreboard=scoreboard) diff --git a/static/scoreboard.js b/static/scoreboard.js index 34ce2009..6df3116c 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){ - + // upon success, update the scoreboard with the new scores + display_scoreboard(result.scoreboard); }, error: function(request, status, error){ console.log("Error");