Fix player count in table index, adds user_count to table
This commit is contained in:
parent
8b3a3e0dde
commit
42bacea451
@ -22,6 +22,9 @@ class Table < ActiveRecord::Base
|
||||
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
|
||||
self.games.last
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
- @tables.each do |table|
|
||||
.table
|
||||
.title= link_to table.title, table
|
||||
.player-count= "#{table.users.count} Players"
|
||||
.player-count= "#{table.user_count} Players"
|
||||
|
||||
- if policy(table).update?
|
||||
.owner-controls
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user