Summary CRUD completed
This commit is contained in:
@ -14,11 +14,9 @@ class CandidateController < ApplicationController
|
||||
|
||||
def question
|
||||
qid = prep_status.current_question_id
|
||||
|
||||
redirect_to :summary and return if qid.nil?
|
||||
|
||||
prep_question qid
|
||||
@answer = @question.answer.nil? ? Answer.new : Answer.find(@question.answer_id)
|
||||
prep_instance_answer @question
|
||||
end
|
||||
|
||||
def update_answer
|
||||
@ -28,13 +26,14 @@ class CandidateController < ApplicationController
|
||||
end
|
||||
|
||||
def live_coder
|
||||
question
|
||||
prep_question params[:question_id]
|
||||
prep_instance_answer @question
|
||||
prep_answer params[:question_id]
|
||||
render layout: false
|
||||
end
|
||||
|
||||
def summary
|
||||
@quiz = current_candidate.my_quiz
|
||||
|
||||
redirect_to :question and return unless prep_status.current_question_id.nil?
|
||||
end
|
||||
|
||||
@ -67,6 +66,10 @@ class CandidateController < ApplicationController
|
||||
@status ||= QuizStatus.new(current_candidate)
|
||||
end
|
||||
|
||||
def prep_instance_answer question
|
||||
@answer = question.answer.nil? ? Answer.new : Answer.find(question.answer_id)
|
||||
end
|
||||
|
||||
def answer_params
|
||||
params.require(:answer).permit(
|
||||
:question_id, :answer_id,
|
||||
|
Reference in New Issue
Block a user