class Cat4WomensRaceSeries

Count pre-set list of series source_events + manually-entered non-series events

Public Instance Methods

association_point_schedule() click to toggle source
# File app/models/competitions/cat4_womens_race_series.rb, line 31
def association_point_schedule
  RacingAssociation.current.cat4_womens_race_series_points
end
cat_4_categories() click to toggle source
# File app/models/competitions/cat4_womens_race_series.rb, line 43
def cat_4_categories
  [ category ] + category.descendants
end
category() click to toggle source
# File app/models/competitions/cat4_womens_race_series.rb, line 47
def category
  @category ||= RacingAssociation.current.cat4_womens_race_series_category || Category.find_or_create_by_name("Women Cat 4")
end
create_races() click to toggle source
# File app/models/competitions/cat4_womens_race_series.rb, line 39
def create_races
  races.create :category => category
end
friendly_name() click to toggle source
# File app/models/competitions/cat4_womens_race_series.rb, line 5
def friendly_name
  "Cat 4 Womens Race Series"
end
members_only?() click to toggle source
# File app/models/competitions/cat4_womens_race_series.rb, line 35
def members_only?
  false
end
participation_points?() click to toggle source
# File app/models/competitions/cat4_womens_race_series.rb, line 27
def participation_points?
  RacingAssociation.current.award_cat4_participation_points?
end
source_results(race) click to toggle source
# File app/models/competitions/cat4_womens_race_series.rb, line 9
def source_results(race)
  _end_date = RacingAssociation.current.cat4_womens_race_series_end_date || self.end_date
  Result.find_by_sql(
    [%Q{ SELECT results.*
        FROM results  
        LEFT JOIN races ON races.id = results.race_id 
        LEFT JOIN categories ON categories.id = races.category_id 
        LEFT JOIN events ON races.event_id = events.id 
        WHERE (place > 0 or place is null or place = '')
          and categories.id in (?)
          and (events.type = "SingleDayEvent" or events.type is null or events.id in (?))
          and events.ironman is true
          and events.date between ? and ?
        order by person_id
     }, category_ids_for(race), source_events.collect(&:id), date.beginning_of_year, _end_date ]
  )
end