Skip to content

Commit

Permalink
feat: Alert confirmation after promoting/removing a bus captain
Browse files Browse the repository at this point in the history
  • Loading branch information
sman591 committed May 29, 2019
1 parent 14643c0 commit abc034d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions app/controllers/manage/bus_lists_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,22 +44,25 @@ def toggle_bus_captain
is_bus_captain = params[:bus_captain] == "1"
@questionnaire.update_attribute(:is_bus_captain, is_bus_captain)
if @questionnaire.reload.is_bus_captain
flash[:notice] = "#{@questionnaire.full_name} has been promoted to a bus captain."
Message.queue_for_trigger("bus_list.new_captain_confirmation", @questionnaire.user.id)
else
flash[:notice] = "#{@questionnaire.full_name} has been removed as a bus captain."
end
redirect_to [:manage, @bus_list]
end

def send_update_email
if Message.for_trigger("bus_list.notes_update").empty?
flash[:alert] = 'Error: No automated message is configured for bus note updates!'
flash[:alert] = "Error: No automated message is configured for bus note updates!"
redirect_to [:manage, @bus_list]
return
end

@bus_list.passengers.each do |passenger|
Message.queue_for_trigger("bus_list.notes_update", passenger.id).count
end
flash[:notice] = 'Bus notes update emails have been sent'
flash[:notice] = "Bus notes update emails have been sent"
redirect_to [:manage, @bus_list]
end

Expand Down

0 comments on commit abc034d

Please sign in to comment.