Class Ironman
In: app/models/competitions/ironman.rb
Parent: Competition

Who has done the most events? Just counts starts/appearences in results. Not pefect — some events are probably over-counted.

Methods

Public Class methods

[Source]

    # File app/models/competitions/ironman.rb, line 8
 8:   def Ironman.years
 9:     years = []
10:     results = connection.select_all(
11:       "select distinct extract(year from date) as year from events where type = 'Ironman'"
12:     )
13:     results.each do |year|
14:       years << year.values.first.to_i
15:     end
16:     years.sort.reverse
17:   end

Public Instance methods

[Source]

    # File app/models/competitions/ironman.rb, line 23
23:   def break_ties?
24:     false
25:   end

[Source]

   # File app/models/competitions/ironman.rb, line 4
4:   def friendly_name
5:     'Ironman'
6:   end

[Source]

    # File app/models/competitions/ironman.rb, line 19
19:   def points_for(source_result)
20:     1
21:   end

[Source]

    # File app/models/competitions/ironman.rb, line 27
27:   def source_results(race)
28:     Result.find_by_sql(
29:       %Q{SELECT results.* FROM results  
30:          LEFT OUTER JOIN races ON races.id = results.race_id 
31:          LEFT OUTER JOIN events ON races.event_id = events.id 
32:          WHERE (place != 'DNS'
33:            and races.category_id is not null 
34:            and (events.type = 'SingleDayEvent' or events.type is null)
35:            and events.ironman = true 
36:            and events.date >= '#{year}-01-01' 
37:            and events.date <= '#{year}-12-31')
38:          ORDER BY person_id}
39:     )
40:   end

[Validate]