Clear Play To Beat when play is passed by all other players

This commit is contained in:
Jesse C. Fisher 2019-10-26 04:28:19 -07:00
parent 00b24af7a2
commit bbfb20a390
4 changed files with 7 additions and 2 deletions

View File

@ -115,7 +115,6 @@ ol#cards-to-beat
margin-left: -21vmin
// Don't offset first card
&:first-of-type
// margin-left: 0
margin-left: -4vmin
flex: 1 1 auto
//flex: 1 1 auto

View File

@ -124,6 +124,11 @@ class Game < ActiveRecord::Base
when 'next'
self.controlling_player_id = self.next_player_id
end
# Clear play to beat if play returns to owner
if self.play_to_beat.try(:player).try(:id) == self.controlling_player_id
self.play_to_beat_id = nil
end
end
def joinable? user

View File

@ -1,4 +1,5 @@
class PlayToBeat < ActiveRecord::Base
belongs_to :game
belongs_to :play
has_one :player, through: :play
end

View File

@ -1,6 +1,6 @@
#play-to-beat
%h4 Hand to beat:
- if @game.play_to_beat.play == nil
- if @game.play_to_beat == nil
None
- else