From 6125908f9ee2dc873dc3e377479e90d36d4cfdb9 Mon Sep 17 00:00:00 2001 From: sharma-aarushi Date: Sat, 14 Dec 2024 11:55:45 -0500 Subject: [PATCH 1/2] Added dynamic score updating and displaying in decreasing order --- server.py | 3 +++ static/scoreboard.js | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/server.py b/server.py index 372a266c..fd20dc10 100644 --- a/server.py +++ b/server.py @@ -50,6 +50,9 @@ def increase_score(): for team in scoreboard: if team["id"] == team_id: team["score"] += 1 + + #Sorting after changes in scores before sending to result in scoreboard.js + 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..62b3a67a 100644 --- a/static/scoreboard.js +++ b/static/scoreboard.js @@ -32,7 +32,7 @@ function increase_score(id){ contentType: "application/json; charset=utf-8", data : JSON.stringify(team_id), success: function(result){ - + display_scoreboard(result.scoreboard); //Displaying updated scores dynamically }, error: function(request, status, error){ console.log("Error"); From 6fc06aee5d81a78ff806f057c0b2688a53f65377 Mon Sep 17 00:00:00 2001 From: sharma-aarushi Date: Sat, 14 Dec 2024 12:02:00 -0500 Subject: [PATCH 2/2] Aarushi Sharma as6322 --- server.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server.py b/server.py index fd20dc10..37a2cdcc 100644 --- a/server.py +++ b/server.py @@ -50,7 +50,7 @@ def increase_score(): for team in scoreboard: if team["id"] == team_id: team["score"] += 1 - + #Sorting after changes in scores before sending to result in scoreboard.js scoreboard.sort(key=lambda x: x["score"], reverse=True)