linked into views
This commit is contained in:
@ -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
|
||||
|
@ -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,
|
||||
|
Reference in New Issue
Block a user