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

Finals Guian

parent 6eaa926e
...@@ -5,18 +5,19 @@ class ElectionController < ApplicationController ...@@ -5,18 +5,19 @@ class ElectionController < ApplicationController
@positions = Position.all @positions = Position.all
@position = Position.find(params[:id]) @position = Position.find(params[:id])
@candidates = Candidate.all @candidates = Candidate.all
@votes = Vote.all @user = User.find(params[:id])
voted_for = false #@votes = Vote.all
@position.candidates.each do |c| #@position.candidates.each do |c|
c.votes.each do |v| # c.votes.each do |v|
if current_user.id == v.user_id # if current_user.id == v.user_id
voted_for = true # voted_for = true
end # end
end # end
end # end
if voted_for == false if current_user.id == @user
#if voted_for == false
redirect_to new_voting_vote_path redirect_to new_voting_vote_path
else else
redirect_to voting_votes_path 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