class SetGame
Model for a game
Overview¶ ↑
-
A game belongs to a MatchSet
-
A game has a state:
-
:in_progress
-
:finished
-
-
A game has an ordinal. The first game in the set has ordinal 1
-
A game may have a winning team
-
A game may be a tiebreak
A tiebreak is a special kind of game that occurs at the end of a set
-
A non-tiebreak game has a serving player
Schema Information¶ ↑
Table name: set_games
id :integer not null, primary key ordinal :integer not null match_set_id :integer not null team_winner_id :integer created_at :datetime not null updated_at :datetime not null player_server_id :integer tiebreaker :boolean default(FALSE), not null
Public Instance Methods
state()
click to toggle source
Get the state of a game
-
Returns : symbol
-
:in_progress
or -
:finished
-
# File app/models/set_game.rb, line 42 def state team_winner_id ? :finished : :in_progress end
tiebreak?()
click to toggle source
Indicate if the game is a tiebreak
-
Returns : Boolean
# File app/models/set_game.rb, line 48 def tiebreak? tiebreaker end