Add upvote field
This commit is contained in:
parent
2a4a4c3caa
commit
2a167ba8ad
1 changed files with 2 additions and 2 deletions
|
@ -203,7 +203,7 @@ def add_song():
|
||||||
## add the song in the room if does not exists
|
## add the song in the room if does not exists
|
||||||
if song.uuid not in room.songs:
|
if song.uuid not in room.songs:
|
||||||
room.songs[song.uuid] = (song, 1) # start with one vote
|
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}
|
return {"success": True, "song": song}
|
||||||
|
|
||||||
|
@ -235,7 +235,7 @@ def post_song_vote():
|
||||||
|
|
||||||
## update the song
|
## update the song
|
||||||
room.songs[song_id] = (song_info[0], song_info[1] + int(request.args["increment"]))
|
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}
|
return {"success": True}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue