Add feedback when voting
This commit is contained in:
parent
a93ae1269b
commit
da30b02405
3 changed files with 16 additions and 2 deletions
4
vedia.rb
4
vedia.rb
|
|
@ -510,15 +510,15 @@ post '/votes/:id/ratings' do
|
|||
end
|
||||
if not @errors.empty?
|
||||
@params = params
|
||||
erb :votes_show_open
|
||||
else
|
||||
@vote.candidates.each do |candidate|
|
||||
rating = Rating.find_or_initialize_by(vote: @vote, user: current_user, candidate: candidate)
|
||||
rating.value = params[candidate.id.to_s]
|
||||
rating.save
|
||||
end
|
||||
redirect '/votes/' + @vote.secure_id
|
||||
@voted = true
|
||||
end
|
||||
erb :votes_show_open
|
||||
end
|
||||
|
||||
get '/votes/:id/organizers' do
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue