fixed up a reviewer to reviewee association
This commit is contained in:
parent
e0f5e482be
commit
5ef7f82dbf
@ -75,7 +75,7 @@ guard :shell, all_on_start: true do
|
||||
# TODO: Annoyingly, all files are linted twice on start/full runs. Why?
|
||||
watch %r{app/assets/javascripts/*/.*} do |file|
|
||||
system %(echo "ESLint:\033[32m #{file[0]}\033[0m")
|
||||
system %(eslint #{file[0]})
|
||||
system %(./node_modules/eslint/bin/eslint.js #{file[0]})
|
||||
end
|
||||
end
|
||||
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 311 B |
Binary file not shown.
Before Width: | Height: | Size: 282 B |
Binary file not shown.
Before Width: | Height: | Size: 316 B |
Binary file not shown.
Before Width: | Height: | Size: 274 B |
@ -6,6 +6,8 @@ class User < ApplicationRecord
|
||||
has_many :quizzes, through: :reviewer_to_quizzes
|
||||
has_many :votes, class_name: 'ReviewerVote'
|
||||
|
||||
has_many :reviewees, through: :quizzes, source: :candidates
|
||||
|
||||
validates :email, presence: true, uniqueness: true
|
||||
validates :name, presence: true
|
||||
validates :role, presence: true
|
||||
|
@ -8,8 +8,7 @@ class ReviewerVotePolicy < ApplicationPolicy
|
||||
# Only Managers, and Admins, can veto a quiz result
|
||||
|
||||
def up?
|
||||
# return true if user.acts_as_admin?
|
||||
# user.quizzes.include? record.candidate.quiz
|
||||
# return true if user.reviewees.include? record.candidate
|
||||
true
|
||||
end
|
||||
|
||||
|
@ -15,12 +15,20 @@
|
||||
<%= form.select :role, admin_role_options(user.role), include_blank: false %>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div><strong>Quiz Review List</strong></div>
|
||||
<p>
|
||||
Quizzes this user should be reviewing the results of.<br />
|
||||
Admins and Recruiters should not have any checked, unless they are expected
|
||||
to participate in the technical review for that quiz.
|
||||
</p>
|
||||
<%= form.collection_check_boxes(:quiz_ids, Quiz.all, :id, :name, {}, {class: 'checkbox'}) do | quiz | %>
|
||||
<div class="form-group-multiples">
|
||||
<%= quiz.check_box( checked: user.quizzes.include?(quiz.object)) %>
|
||||
<%= quiz.label %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<%= form.submit %>
|
||||
<% end %>
|
||||
|
@ -28,9 +28,11 @@ module Admin
|
||||
henry = candidates(:henry)
|
||||
get admin_up_vote_url(henry.test_hash)
|
||||
|
||||
assert_difference("Candidate.find(#{henry.id}).votes.yea.count", -1) do
|
||||
assert_difference("Candidate.find(#{henry.id}).votes.nay.count", 1) do
|
||||
get admin_down_vote_url(henry.test_hash)
|
||||
end
|
||||
end
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
|
4
test/fixtures/reviewer_to_quizzes.yml
vendored
4
test/fixtures/reviewer_to_quizzes.yml
vendored
@ -7,3 +7,7 @@ one:
|
||||
two:
|
||||
user: reviewer2
|
||||
quiz: fed
|
||||
|
||||
three:
|
||||
user: manager
|
||||
quiz: fed
|
||||
|
@ -29,14 +29,13 @@ class ReviewerVotePolicyTest < PolicyAssertions::Test
|
||||
end
|
||||
|
||||
def test_up
|
||||
skip
|
||||
# assert_permit users(:admin), candidates(:richard)
|
||||
# refute_permit users(:admin), reviewer_votes(:manager_henry)
|
||||
# refute_permit users(:recruiter), candidates(:richard)
|
||||
# refute_permit users(:reviewer), candidates(:gustov)
|
||||
|
||||
# assert_permit users(:admin), candidates(:gustov)
|
||||
# assert_permit users(:manager), candidates(:richard)
|
||||
# assert_permit users(:reviewer), candidates(:richard)
|
||||
#
|
||||
# refute_permit users(:reviewer), candidates(:gustov)
|
||||
# refute_permit users(:recruiter), candidates(:richard)
|
||||
end
|
||||
|
||||
# def test_create_and_update
|
||||
|
Loading…
Reference in New Issue
Block a user