Class Score
In: app/models/competitions/score.rb
Parent: ActiveRecord::Base

Tie a Competition Result to its source Result from a SingleDayEvent, and holds the points earned for the Competition

Example: John Walrod places 3rd in the Mudslinger Singlespeed race. This earns him points for both the Singlespeed BAR and the Ironman:

Singlespeed BAR Score

  • points: 22
  • source_result: 3rd, Mudslinger
  • competition_result: 18th Singlespeed BAR

Ironman Score

  • points: 1
  • source_result: 3rd, Mudslinger
  • competition_result: 200th Ironman

Methods

Public Instance methods

Compare by points

[Source]

    # File app/models/competitions/score.rb, line 31
31:   def <=>(other)
32:     other.points <=> points
33:   end

[Source]

    # File app/models/competitions/score.rb, line 22
22:   def discipline
23:     self.competition_result.race.discipline
24:   end

[Source]

    # File app/models/competitions/score.rb, line 26
26:   def source_event_date
27:     date || source_result.event.date
28:   end

[Source]

    # File app/models/competitions/score.rb, line 35
35:   def to_s
36:     "#<Score #{id} #{source_result_id} #{competition_result_id} #{points}>"
37:   end

[Validate]