@@ -15,28 +15,29 @@ defmodule PointingPartyWeb.RoomChannel do
1515 { :noreply , socket }
1616 end
1717
18+ def handle_in ( "start_pointing" , _params , socket ) do
19+ updated_socket = initialize_state ( socket )
20+ # broadcast the "new_card" message with a payload of %{card: current_card}
21+
22+ { :reply , :ok , updated_socket }
23+ end
24+
1825 def handle_in ( "user_estimated" , % { "points" => points } , socket ) do
1926 # update votes for user presence
20- # calculate votes if everyone voted with the help of the VoteCalculator
27+ # if everyone voted, calculate story point estimate with the help of the VoteCalculator
2128 # broadcast the 'winner'/'tie' event with a payload of %{points: points}
2229
2330 { :noreply , socket }
2431 end
2532
26- def handle_in ( "finalized_points" , % { "points" => points } , socket ) do
33+ def handle_in ( "next_card" , % { "points" => points } , socket ) do
34+ # update the current card's `points` value to `points` from the message payload
2735 # update state by setting the current card to the next card
2836 # broadcast the "new_card" message with a payload of %{card: new_current_card}
2937
3038 { :reply , :ok , socket }
3139 end
3240
33- def handle_in ( "start_pointing" , _params , socket ) do
34- updated_socket = initialize_state ( socket )
35- # broadcast the "new_card" message with a payload of %{card: current_card}
36-
37- { :reply , :ok , updated_socket }
38- end
39-
4041 defp initialize_state ( % { assigns: % { cards: _cards } } = socket ) , do: socket
4142
4243 defp initialize_state ( socket ) do
0 commit comments