Commit 389ec497 authored by April Guian's avatar April Guian

Finals Guian

parent 6eaa926e
......@@ -5,18 +5,19 @@ class ElectionController < ApplicationController
@positions = Position.all
@position = Position.find(params[:id])
@candidates = Candidate.all
@votes = Vote.all
voted_for = false
@user = User.find(params[:id])
#@votes = Vote.all
@position.candidates.each do |c|
c.votes.each do |v|
if current_user.id == v.user_id
voted_for = true
end
end
end
#@position.candidates.each do |c|
# c.votes.each do |v|
# if current_user.id == v.user_id
# voted_for = true
# end
# end
# end
if voted_for == false
if current_user.id == @user
#if voted_for == false
redirect_to new_voting_vote_path
else
redirect_to voting_votes_path
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment