Fix player count in table index, adds user_count to table

This commit is contained in:
Jesse C. Fisher 2019-10-29 03:10:40 -07:00
parent cc4395e3c3
commit b6d87b63b4
2 changed files with 4 additions and 1 deletions

View File

@ -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

View File

@ -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