Class: FReCon::Team
Overview
Public: The Team model.
Class Method Summary collapse
-
.number(team_number) ⇒ Object
(also: with_number, that_has_number)
Public: Find a team by number.
Instance Method Summary collapse
-
#competitions ⇒ Object
Public: Get this Team’s Robots’ Participations’ Competitions.
-
#matches ⇒ Object
Public: Get this Team’s Robots’ Participations’ Competitions’ Matches.
-
#participations ⇒ Object
Public: Get this Team’s Robots’ Participations.
-
#records ⇒ Object
Public: Get this Team’s Robots’ Participations’ Records.
Methods inherited from Model
controller, descendants, inherited, #no_invalid_relations
Class Method Details
.number(team_number) ⇒ Object Also known as: with_number, that_has_number
Public: Find a team by number.
team_number - An Integer to be used to compare.
Returns a Team if one exists with the given number, otherwise nil.
31 32 33 |
# File 'lib/frecon/models/team.rb', line 31 def self.number(team_number) find_by number: team_number end |
Instance Method Details
#competitions ⇒ Object
Public: Get this Team’s Robots’ Participations’ Competitions
41 42 43 |
# File 'lib/frecon/models/team.rb', line 41 def competitions Competition.in id: participations.map(&:competition_id) end |
#matches ⇒ Object
Public: Get this Team’s Robots’ Participations’ Competitions’ Matches
51 52 53 |
# File 'lib/frecon/models/team.rb', line 51 def matches Match.in competition_id: competitions.map(&:id) end |
#participations ⇒ Object
Public: Get this Team’s Robots’ Participations
36 37 38 |
# File 'lib/frecon/models/team.rb', line 36 def participations Participation.in robot_id: robots.map(&:id) end |