Class: FReCon::Team

Inherits:
Model show all
Defined in:
lib/frecon/models/team.rb

Overview

Public: The Team model.

Class Method Summary collapse

Instance Method Summary collapse

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

#competitionsObject

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

#matchesObject

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

#participationsObject

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

#recordsObject

Public: Get this Team’s Robots’ Participations’ Records



46
47
48
# File 'lib/frecon/models/team.rb', line 46

def records
	Record.in participation_id: participations.map(&:id)
end