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