Skip to content

Commit 07f973b

Browse files
wip refactor
1 parent 6adbdde commit 07f973b

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

assets/js/socket.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ startButton.addEventListener('click', e => {
2626
const nextCardButtons = document.getElementsByClassName('next-card')
2727
for (let i = 0;i < nextCardButtons.length; i++) {
2828
nextCardButtons[i].addEventListener('click', e => {
29-
channel.push('finalized_points', {points: e.target.value})
29+
channel.push('next_card', {points: e.target.value})
3030
})
3131
}
3232

lib/pointing_party_web/channels/room_channel.ex

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,14 @@ defmodule PointingPartyWeb.RoomChannel do
2222
Presence.update(socket, socket.assigns.username, &(Map.put(&1, :points, points)))
2323

2424
if everyone_voted?(socket) do
25-
finalize_voting(socket)
25+
calculate_story_points(socket)
2626
end
2727

2828
{:noreply, socket}
2929
end
3030

31-
def handle_in("finalized_points", %{"points" => points}, socket) do
31+
def handle_in("next_card", %{"points" => points}, socket) do
3232
updated_socket = save_vote_next_card(points, socket)
33-
# clear_user_points(socket)
3433
broadcast!(updated_socket, "new_card", %{card: current_card(updated_socket)})
3534
{:reply, :ok, updated_socket}
3635
end
@@ -64,7 +63,7 @@ defmodule PointingPartyWeb.RoomChannel do
6463
|> Enum.all?(&(not is_nil(&1)))
6564
end
6665

67-
defp finalize_voting(socket) do
66+
defp calculate_story_points(socket) do
6867
current_users = Presence.list(socket)
6968

7069
{event, points} = VoteCalculator.calculate_votes(current_users)

0 commit comments

Comments
 (0)