24 lines
425 B
Ruby
24 lines
425 B
Ruby
|
class QuizStatus
|
||
|
attr_reader :candidate
|
||
|
|
||
|
def initialize candidate
|
||
|
@candidate = Candidate.find(candidate.to_i)
|
||
|
end
|
||
|
|
||
|
def started
|
||
|
candidate.answers.count > 0
|
||
|
end
|
||
|
|
||
|
def on_summary
|
||
|
candidate.submitted_answers.count == candidate.questions.count
|
||
|
end
|
||
|
|
||
|
def completed
|
||
|
candidate.completed
|
||
|
end
|
||
|
|
||
|
def can_submit
|
||
|
on_summary && candidate.answered_questions.count == candidate.questions.count
|
||
|
end
|
||
|
end
|