module UpcomingEvents

All SingleDayEvents that will occur in the next weeks. Used to display a list of upcoming events on the homepage. Organized by parent class (WeeklySeries and everything else) and Discipline: @events: Hash keyed by Discipline#name @weekly_series: Hash keyed by Discipline#name

Does not simply add weeks to date when selecting events – applies a week boundary on Monday

Public Class Methods

find_all(*conditions) click to toggle source

UpcomingEvents needs methods on Discipline, but logic is more about upcoming events

# File app/models/upcoming_events.rb, line 4
def UpcomingEvents.find_all(*conditions)
  conditions_hash = conditions.extract_options!
  upcoming_events =[:date], conditions_hash[:weeks], conditions_hash[:discipline])
  upcoming_events.disciplines.each do |discipline|
    discipline.upcoming_events = discipline.find_all_upcoming_events(upcoming_events.dates)
    discipline.upcoming_weekly_series = discipline.find_all_upcoming_weekly_series(upcoming_events.dates)
  upcoming_events.disciplines.delete_if { |discipline| discipline.upcoming_events.empty? && discipline.upcoming_weekly_series.empty? }