Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
final_project
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
evilla_gomez_guian_principe
final_project
Commits
44dbc0dc
Commit
44dbc0dc
authored
Jul 21, 2016
by
April Guian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
May nadagdag na di dapat
parent
25ece4ec
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
78 deletions
+0
-78
Ind Task Notes
Halalan-FINAL/config/Ind Task Notes
+0
-78
No files found.
Halalan-FINAL/config/Ind Task Notes
deleted
100644 → 0
View file @
25ece4ec
def vote
voted_for = false
@position = Position.find(params[:position_id])
#@candidate = params[:candidate_id]
#@pos = params[:id]
#@candidate = Candidate.new
#if current_user voted_for candidate.position
#Position.find(@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
#@post = Post.find(params[:post_id])
#@post.liked_by current_user
#respond_to do |format|
# format.html {redirect_to :back }
#end
#@position.voted_for current_user
if position.voted_for == false
# @vote = Vote.new
redirect_to new_voting_vote_path(@vote.id)
else
redirect_to admin_candidates_path
end
end
if position.voted_for == false
redirect_to new_voting_vote_path(@vote.id)
else
redirect_to admin_candidates_path, notice: "Sorry, you can only vote on a position and candidate once."
end
---------------
votes = Vote.all
voted_for = false
positions = Position.all
candidates = Candidate.all
@position = Position.find(params[:id])
candidates(@position).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
#@votes= Vote.all
@candidate = Candidate.find(params[:id])
#@vote = Vote.new
redirect_to new_voting_vote_path(@candidate)
else
redirect_to admin_candidates_path
end
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment