Arp-G / pictionary

Picture guessing and drawing multiplayer game
https://pictionary-game.netlify.app
MIT License
32 stars 5 forks source link

Bug causing mixed data in ETS #1

Closed al2o3cr closed 3 years ago

al2o3cr commented 3 years ago

https://github.com/Arp-G/pictionary/blob/c9ac9d768519f5ae67d0aeab8e6714d2c48ba695/lib/pictionary/stores/game_store.ex#L111

This is caused by the declaration of one of the handle_call clauses:

https://github.com/Arp-G/pictionary/blob/c9ac9d768519f5ae67d0aeab8e6714d2c48ba695/lib/pictionary/stores/game_store.ex#L88

This captures the {:set, %Game{}} part of the input, when it probably should be:

def handle_call({:set, %Game{id: game_id} = game_data}, _from, state) do

(scooting a closing } over a little bit), which would match the other place :ets.insert is called:

https://github.com/Arp-G/pictionary/blob/c9ac9d768519f5ae67d0aeab8e6714d2c48ba695/lib/pictionary/stores/game_store.ex#L100-L103

Arpan-Kreeti commented 3 years ago

This is awesome, I spend some time trying to figure out what the problem was, thanks a lot for pointing out the problem. I will create a PR for this.