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.
30 31 32 |
# File 'lib/frecon/models/team.rb', line 30 def self.number(team_number) find_by number: team_number end |
Instance Method Details
#competitions ⇒ Object
Public: Get this Team’s Robots’ Participations’ Competitions
40 41 42 |
# File 'lib/frecon/models/team.rb', line 40 def competitions Competition.in id: participations.map(&:competition_id) end |
#matches ⇒ Object
Public: Get this Team’s Robots’ Participations’ Competitions’ Matches
50 51 52 |
# File 'lib/frecon/models/team.rb', line 50 def matches Match.in competition_id: competitions.map(&:id) end |
#participations ⇒ Object
Public: Get this Team’s Robots’ Participations
35 36 37 |
# File 'lib/frecon/models/team.rb', line 35 def participations Participation.in robot_id: robots.map(&:id) end |
#records ⇒ Object
Public: Get this Team’s Robots’ Participations’ Records
45 46 47 |
# File 'lib/frecon/models/team.rb', line 45 def records Record.in participation_id: participations.map(&:id) end |