43 lines
850 B
Ruby
43 lines
850 B
Ruby
class CandidateController < ApplicationController
|
|
def welcome
|
|
end
|
|
|
|
def question
|
|
@question = Question.order("RAND()").first # .where(input_type: 'live-coder')
|
|
@status = QuizStatus.new(Candidate.order("RAND()").first)
|
|
@answer = @question.answers.order("RAND()").first
|
|
end
|
|
|
|
def update_question
|
|
redirect_to :summary and return if params.key?(:update)
|
|
redirect_to :saved and return if params.key?(:save)
|
|
redirect_to :question
|
|
end
|
|
|
|
def summary
|
|
@candidate = Candidate.where(test_hash: '6NjnourLE6Y').first
|
|
@answers = @candidate.answers
|
|
@status = QuizStatus.new(@candidate)
|
|
end
|
|
|
|
def update_summary
|
|
redirect_to :summary
|
|
end
|
|
|
|
def thankyou
|
|
end
|
|
|
|
def saved
|
|
end
|
|
|
|
def validate
|
|
redirect_to :question
|
|
end
|
|
|
|
# private
|
|
#
|
|
# def question_params
|
|
# params.permit(:save)
|
|
# end
|
|
end
|