Skip to content
Open
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions .worktrees/n1-queries-events
Submodule n1-queries-events added at ed6e15
4 changes: 2 additions & 2 deletions app/controllers/admin/events_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def show
@attending_students = InvitationPresenter.decorate_collection(@original_event.attending_students)
@attending_coaches = InvitationPresenter.decorate_collection(@original_event.attending_coaches)

return render plain: @event.attendees_csv if request.format.csv?
render plain: @event.attendees_csv if request.format.csv?
end

def update
Expand Down Expand Up @@ -67,7 +67,7 @@ def attendees_emails
private

def set_event
@original_event = Event.find_by(slug: params[:id])
@original_event = Event.find_by!(slug: params[:id])
@event = EventPresenter.new(@original_event)
end

Expand Down
2 changes: 1 addition & 1 deletion app/controllers/admin/invitations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def update_to_not_attending
end

def set_invitation
@invitation = @workshop.invitations.find_by(token: invitation_id)
@invitation = @workshop.invitations.find_by!(token: invitation_id)
end

def invitation_id
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/admin/meeting_invitations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def create
private

def set_invitation
@invitation = MeetingInvitation.find_by(token: id)
@invitation = MeetingInvitation.find_by!(token: id)
end

def id
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/admin/meetings_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def create
def show
@invitations = @meeting.invitations.accepted.includes(:member).order(:created_at)

return render plain: @meeting.attendees_csv if request.format.csv?
render plain: @meeting.attendees_csv if request.format.csv?
end

def edit; end
Expand Down Expand Up @@ -54,7 +54,7 @@ def invite
private

def set_meeting
@meeting = Meeting.find_by(slug: slug)
@meeting = Meeting.find_by!(slug: slug)
end

def slug
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/concerns/workshop_invitation_concerns.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def back_with_message(message)
end

def set_invitation
@invitation = WorkshopInvitation.find_by(token: token)
@invitation = WorkshopInvitation.find_by!(token: token)
end
end
end
2 changes: 1 addition & 1 deletion app/controllers/contact_preferences_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def show
end

def update
contact = Contact.find_by(token: contact_preferences[:token])
contact = Contact.find_by!(token: contact_preferences[:token])
contact.update(mailing_list_consent: mailing_list_consent)
audit_contact_subscription(contact)

Expand Down
11 changes: 6 additions & 5 deletions app/controllers/events_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,17 @@ def index
events << Event.past.includes(:venue, :sponsors).limit(RECENT_EVENTS_DISPLAY_LIMIT)
events = events.compact.flatten.sort_by(&:date_and_time).reverse.first(RECENT_EVENTS_DISPLAY_LIMIT)
events_hash_grouped_by_date = events.group_by(&:date)
@past_events = events_hash_grouped_by_date.map.inject({}) do |hash, (key, value)|
@past_events = events_hash_grouped_by_date.map.each_with_object({}) do |(key, value), hash|
hash[key] = EventPresenter.decorate_collection(value)
hash
end

events = [Workshop.includes(:chapter).upcoming.joins(:chapter).merge(Chapter.active)]
events << Meeting.upcoming.all
events << Event.upcoming.includes(:venue, :sponsors).all
events = events.compact.flatten.sort_by(&:date_and_time).group_by(&:date)
@events = events.map.inject({}) { |hash, (key, value)| hash[key] = EventPresenter.decorate_collection(value); hash }
@events = events.map.each_with_object({}) do |(key, value), hash|
hash[key] = EventPresenter.decorate_collection(value)
end
end

def show
Expand All @@ -34,7 +35,7 @@ def show
return unless logged_in?

invitation = Invitation.find_by(member: current_user, event: event, attending: true)
return redirect_to event_invitation_path(@event, invitation) if invitation
redirect_to event_invitation_path(@event, invitation) if invitation
end

def student
Expand Down Expand Up @@ -74,6 +75,6 @@ def find_invitation_and_redirect_to_event(role)
end

def set_event
@event = Event.find_by(slug: params[:event_id])
@event = Event.find_by!(slug: params[:event_id])
end
end
2 changes: 1 addition & 1 deletion app/controllers/feedback_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def submit

redirect_to root_path
else
feedback_request = FeedbackRequest.find_by(token: params[:id], submited: false)
feedback_request = FeedbackRequest.find_by!(token: params[:id], submited: false)
set_coaches(feedback_request.workshop)

@workshop = feedback_request.workshop
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/invitations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def rsvp_meeting
end

def cancel_meeting
@invitation = MeetingInvitation.find_by(token: params[:token])
@invitation = MeetingInvitation.find_by!(token: params[:token])

@invitation.update_attribute(:attending, false)

Expand Down