Skip to content
Open
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
11 changes: 10 additions & 1 deletion app/controllers/admin/rsec_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,18 @@ def find_members
# for the POSITION.
#
def add_elected
if params[:position] == ""
redirect_to admin_rsec_elections_path, notice: "Failed to elect for selected position, since no position was selected"
return
end
if params[:person_id] == ""
redirect_to admin_rsec_elections_path, notice: "Failed to elect for \"#{params[:position]}\" because no one was selected"
return
end
e = Election.new(person_id: params[:person_id].to_i, position: params[:position])
unless e.valid? && e.save
return redirect_to admin_rsec_elections_path, notice: "Failed to elect: #{e.person} because #{e.errors.inspect}"
redirect_to admin_rsec_elections_path, notice: "Failed to elect: #{e.person} because #{e.errors.inspect}"
return
end
redirect_to with_anchor(admin_rsec_elections_path,e.position), notice: "Nominated #{e.position} officer #{e.person.full_name}"
end # add_elected
Expand Down