Fix player count in table index, adds user_count to table
This commit is contained in:
parent
cc4395e3c3
commit
b6d87b63b4
@ -22,6 +22,9 @@ class Table < ActiveRecord::Base
|
|||||||
where(game:nil).last || Table.create(title: "Table " + user.soft_token[0..4])
|
where(game:nil).last || Table.create(title: "Table " + user.soft_token[0..4])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def user_count
|
||||||
|
self.seats.map{|s| s.occupied? ? s : nil}.compact.count
|
||||||
|
end
|
||||||
|
|
||||||
def current_game
|
def current_game
|
||||||
self.games.last
|
self.games.last
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
- @tables.each do |table|
|
- @tables.each do |table|
|
||||||
.table
|
.table
|
||||||
.title= link_to table.title, table
|
.title= link_to table.title, table
|
||||||
.player-count= "#{table.users.count} Players"
|
.player-count= "#{table.user_count} Players"
|
||||||
|
|
||||||
- if policy(table).update?
|
- if policy(table).update?
|
||||||
.owner-controls
|
.owner-controls
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user