Clear Play To Beat when play is passed by all other players
This commit is contained in:
parent
3c12ce661b
commit
2702983318
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
class PlayToBeat < ActiveRecord::Base
|
||||
belongs_to :game
|
||||
belongs_to :play
|
||||
has_one :player, through: :play
|
||||
end
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user