simple question attachments
This commit is contained in:
@ -9,6 +9,10 @@
|
||||
<main class="answer-sec <%= @question.input_type %>-type questions_tpl" data-qid="<%= @question.question_id %>">
|
||||
<h2 class="question-text"><%= @question.question %></h2>
|
||||
|
||||
<% if @question.attachment.present? %>
|
||||
<%= image_tag @question.attachment %>
|
||||
<% end %>
|
||||
|
||||
<div class="content-well">
|
||||
<%= hidden_field_tag 'answer[question_id]', @question.question_id %>
|
||||
<%= hidden_field_tag 'answer[answer_id]', @question.answer_id %>
|
||||
|
@ -1,8 +1,8 @@
|
||||
class CandidateQuiz
|
||||
attr_reader :candidate_id
|
||||
|
||||
def initialize candidate_id
|
||||
@candidate_id = candidate_id
|
||||
def initialize candidate
|
||||
@candidate_id = candidate.to_i
|
||||
end
|
||||
|
||||
def fetch_question qid
|
||||
@ -18,7 +18,7 @@ class CandidateQuiz
|
||||
def raw_quiz qid = nil
|
||||
question = qid.nil? ? "" : " and q.id = #{qid} "
|
||||
sql = "select c.id candidate_id, q.quiz_id, q.id question_id, a.id answer_id, q.sort
|
||||
, q.question, q.category, q.input_type, q.input_options, a.answer
|
||||
, q.question, q.attachment, q.category, q.input_type, q.input_options, a.answer
|
||||
, ifnull(a.saved, false) saved, ifnull(a.submitted, false) submitted , a.updated_at
|
||||
from candidates c
|
||||
inner join questions q on q.quiz_id = c.quiz_id
|
||||
|
@ -26,6 +26,10 @@ class CandidateQuizQuestion
|
||||
row["question"]
|
||||
end
|
||||
|
||||
def attachment
|
||||
row['attachment']
|
||||
end
|
||||
|
||||
def category
|
||||
row["category"]
|
||||
end
|
||||
|
Reference in New Issue
Block a user