linked into views

This commit is contained in:
Mark Moser
2016-11-18 17:43:24 -06:00
committed by Mark Moser
parent 37aa17ec1f
commit 5845f76e1d
14 changed files with 107 additions and 31 deletions

View File

@ -4,6 +4,7 @@ class Candidate < ApplicationRecord
has_many :questions, -> { order("sort") }, through: :quiz
has_many :answers
belongs_to :recruiter, class_name: "User"
has_many :votes, class_name: "ReviewerVote"
serialize :email, CryptSerializer
@ -15,6 +16,12 @@ class Candidate < ApplicationRecord
validates :email, uniqueness: true, presence: true, email_format: true
validates :test_hash, uniqueness: true, presence: true
enum review_status: {
# pending: 0,
approved: 1,
declined: 2
}
def submitted_answers
answers.where(submitted: true)
end

View File

@ -1,10 +1,10 @@
# frozen_string_literal: true
class ReviewerVote < ApplicationRecord
# validates :user_id, uniqueness: {scope: :friend_id}
belongs_to :candidate
belongs_to :user
validates :user_id, uniqueness: { scope: :candidate_id }
enum vote: {
undecided: 0,
yea: 1,