Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions app/controllers/dashboard_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def about; end
def wall_of_fame
@coaches_count = top_coach_query.length
coaches = Member.where(id: top_coach_query
.year(year_param))
.year(year_param))
.includes(:skills)
@pagy, @coaches = pagy(coaches, items: 80)
end
Expand All @@ -55,20 +55,20 @@ def top_coach_query
end

def upcoming_events
workshops = Workshop.upcoming.includes(:chapter, :sponsors)
workshops = Workshop.upcoming.includes(:chapter, :sponsors, :organisers)
all_events(workshops).sort_by(&:date_and_time).group_by(&:date)
end

def upcoming_events_for_user
chapter_workshops = Workshop.upcoming
.where(chapter: current_user.chapters)
.includes(:chapter, :sponsors)
.includes(:chapter, :sponsors, :organisers)
.to_a

accepted_workshops = current_user.workshop_invitations.accepted
.joins(:workshop)
.merge(Workshop.upcoming)
.includes(workshop: %i[chapter sponsors])
.includes(workshop: %i[chapter sponsors organisers])
.map(&:workshop)

all_events(chapter_workshops + accepted_workshops)
Expand All @@ -77,8 +77,8 @@ def upcoming_events_for_user
end

def all_events(workshops)
meeting = Meeting.includes(:venue).next
events = Event.includes(:venue, :sponsors).upcoming.take(DEFAULT_UPCOMING_EVENTS)
meeting = Meeting.includes(:venue, :organisers).next
events = Event.includes(:venue, :sponsors, :organisers).upcoming.take(DEFAULT_UPCOMING_EVENTS)

[*workshops, *events, meeting].uniq.compact
end
Expand Down