skill-assessment-app/app/controllers/candidate_controller.rb

43 lines
850 B
Ruby
Raw Normal View History

2016-07-27 22:16:12 -05:00
class CandidateController < ApplicationController
def welcome
end
def question
2016-07-27 22:53:14 -05:00
@question = Question.order("RAND()").first # .where(input_type: 'live-coder')
2016-07-27 22:16:12 -05:00
@status = QuizStatus.new(Candidate.order("RAND()").first)
@answer = @question.answers.order("RAND()").first
end
2016-07-28 08:47:34 -05:00
def update_question
2016-07-28 20:54:08 -05:00
redirect_to :summary and return if params.key?(:update)
redirect_to :saved and return if params.key?(:save)
2016-07-28 08:47:34 -05:00
redirect_to :question
end
2016-07-27 22:16:12 -05:00
def summary
2016-07-28 20:54:08 -05:00
@candidate = Candidate.where(test_hash: '6NjnourLE6Y').first
@answers = @candidate.answers
@status = QuizStatus.new(@candidate)
end
def update_summary
redirect_to :summary
2016-07-27 22:16:12 -05:00
end
def thankyou
end
def saved
end
2016-07-28 08:47:34 -05:00
def validate
redirect_to :question
end
2016-07-28 09:37:46 -05:00
2016-07-28 20:54:08 -05:00
# private
#
# def question_params
# params.permit(:save)
# end
2016-07-27 22:16:12 -05:00
end