fixed up a reviewer to reviewee association
This commit is contained in:
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>
|
||||
|
||||
<%= 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 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 %>
|
||||
|
Reference in New Issue
Block a user