diff --git a/app/models/user.rb b/app/models/user.rb index ec0a298..a94ee9b 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -50,8 +50,7 @@ class User < ApplicationRecord def my_vote candidate candidate = Candidate.find(candidate.to_i) - my_votes = votes.find_by(candidate_id: candidate.id) - my_votes.nil? ? "undecided" : my_votes.votes + votes.find_by(candidate_id: candidate.id).vote end # Roles diff --git a/test/fixtures/reviewer_votes.yml b/test/fixtures/reviewer_votes.yml index 06a1b3c..0b22140 100644 --- a/test/fixtures/reviewer_votes.yml +++ b/test/fixtures/reviewer_votes.yml @@ -1,4 +1,3 @@ -# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html manager_richard: candidate: richard @@ -17,23 +16,6 @@ reviewer2_richard: -manager_wade: - candidate: wade - user: manager - vote: 2 - veto: 2 - -reviewer_wade: - candidate: wade - user: reviewer - vote: 2 - -# reviewer2_wade: -# candidate: wade -# user: reviewer2 - - - manager_stacy: candidate: stacy user: manager @@ -50,18 +32,33 @@ reviewer2_stacy: vote: 2 - manager_henry: candidate: henry user: manager vote: 0 veto: 2 -# reviewer_henry: -# candidate: henry -# user: reviewer -# -# reviewer2_henry: -# candidate: henry -# user: reviewer2 +reviewer_henry: + candidate: henry + user: reviewer + +reviewer2_henry: + candidate: henry + user: reviewer2 + + +manager_wade: + candidate: wade + user: manager + vote: 2 + veto: 2 + +reviewer_wade: + candidate: wade + user: reviewer + vote: 2 + +reviewer2_wade: + candidate: wade + user: reviewer2