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
389ec497
Commit
389ec497
authored
Jul 21, 2016
by
April Guian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Finals Guian
parent
6eaa926e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
10 deletions
+11
-10
election_controller.rb
Halalan-FINAL/app/controllers/election_controller.rb
+11
-10
No files found.
Halalan-FINAL/app/controllers/election_controller.rb
View file @
389ec497
...
@@ -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
...
...
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