From 2a167ba8ad9d2d8a4ba3a11f0ec9be64befebf5b Mon Sep 17 00:00:00 2001 From: Leonardo Segala Date: Sat, 2 Aug 2025 04:47:04 +0200 Subject: [PATCH] Add upvote field --- backend/src/app.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/src/app.py b/backend/src/app.py index e43184e..247ba5f 100644 --- a/backend/src/app.py +++ b/backend/src/app.py @@ -203,7 +203,7 @@ def add_song(): ## add the song in the room if does not exists if song.uuid not in room.songs: room.songs[song.uuid] = (song, 1) # start with one vote - socketio.emit("new_song", {"song": asdict(song), "user_score": 1}, to=str(room.id)) + socketio.emit("new_song", {"song": asdict(song) | {"upvote": 1}}, to=str(room.id)) return {"success": True, "song": song} @@ -235,7 +235,7 @@ def post_song_vote(): ## update the song room.songs[song_id] = (song_info[0], song_info[1] + int(request.args["increment"])) - socketio.emit("new_vote", {"song": asdict(song_info[0]), "user_score": song_info[1]}) + socketio.emit("new_vote", {"song": asdict(song_info[0]) | {"upvote": song_info[1]}}) return {"success": True}