big start on QuizStatus

This commit is contained in:
Mark Moser committed 2016-07-27 11:17:50 -05:00
1 parent 487351c1b0
commit 7a32057825
16 files changed
+173 -17

No files matched your search

+10
View File
@@ -1,4 +1,6 @@
class Candidate < ApplicationRecord
belongs_to :quiz
has_many :questions, through: :quiz
has_many :answers
belongs_to :recruiter, class_name: "User"
@@ -8,6 +10,14 @@ class Candidate < ApplicationRecord
validates_presence_of :test_hash
validates_uniqueness_of :test_hash
def submitted_answers
answers.where(submitted: true)
end
def answered_questions
answers.where.not(answer: nil)
end
private
def generate_test_hash
+1
View File
@@ -1,3 +1,4 @@
class Quiz < ApplicationRecord
has_many :questions
has_many :candidates
end