试卷的选择题的编号由前端添加

dev_forum
SylorHuang 6 years ago
parent c4389cccf7
commit ab5404268c

@ -21,7 +21,8 @@ if question.question_type <= 2 #当为选择题或判断题时,只显示选
user_answer_b = user_answer.include?(a.id)
json.c_position (index+1) if ex_choice_random_boolean #当选项随机时,选项位置以此为准,否则不出现
json.choice_id a.id
json.choice_text (edit_type.present? || question.question_type == 2) ? a.choice_text : "#{(index+65).chr}.#{a.choice_text}"
# json.choice_text (edit_type.present? || question.question_type == 2) ? a.choice_text : "#{(index+65).chr}.#{a.choice_text}"
json.choice_text a.choice_text
json.choice_position a.choice_position
if exercise_type == 1 || exercise_type == 4 #1为教师编辑/预览 试卷或问题2为空白试卷即标准答案和用户答案都不显示3为用户开始答题的显示4为老师评阅试卷或学生在截止后查看试卷
json.standard_boolean standard_answer_b

@ -35,15 +35,16 @@ json.commit_results do
if q[:type] != Exercise::PRACTICAL
json.ques_details do
json.array! q[:ques_details].each_with_index.to_a do |d,index|
if q[:type] <= Exercise::MULTIPLE
ques_index = (index+65).chr
elsif q[:type] == Exercise::JUDGMENT
ques_index = (index+1).to_s
else
ques_index = nil
end
# if q[:type] <= Exercise::MULTIPLE
# ques_index = (index+65).chr
# elsif q[:type] == Exercise::JUDGMENT
# ques_index = (index+1).to_s
# else
# ques_index = nil
# end
json.choice_position d[:choice_position]
json.choice_text ques_index.present? ? "#{ques_index}.#{d[:choice_text]}" : d[:choice_text]
# json.choice_text ques_index.present? ? "#{ques_index}.#{d[:choice_text]}" : d[:choice_text]
json.choice_text d[:choice_text]
json.choice_users_count d[:choice_users_count]
json.choice_percent d[:choice_percent]
json.choice_right_boolean d[:right_answer]

Loading…
Cancel
Save