| Module | UpcomingEvents |
| In: |
app/models/upcoming_events.rb
app/models/upcoming_events/base.rb app/models/upcoming_events/discipline_extensions.rb |
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
UpcomingEvents needs methods on Discipline, but logic is more about upcoming events
# File app/models/upcoming_events.rb, line 4
4: def UpcomingEvents.find_all(*conditions)
5: conditions_hash = conditions.extract_options!
6: upcoming_events = UpcomingEvents::Base.new(conditions_hash[:date], conditions_hash[:weeks], conditions_hash[:discipline])
7: upcoming_events.disciplines.each do |discipline|
8: discipline.upcoming_events = discipline.find_all_upcoming_events(upcoming_events.dates)
9: discipline.upcoming_weekly_series = discipline.find_all_upcoming_weekly_series(upcoming_events.dates)
10: end
11: upcoming_events.disciplines.delete_if { |discipline| discipline.upcoming_events.empty? && discipline.upcoming_weekly_series.empty? }
12: upcoming_events
13: end