试卷的选项随机修复

dev_forum
SylorHuang 5 years ago
parent e1c40cd30d
commit 72c304faa5

@ -6,10 +6,11 @@ json.question_type question.question_type
json.question_score question.question_score.round(1).to_s
if question.question_type <= 2 #当为选择题或判断题时,只显示选项的位置
standard_answers_array = question.get_standard_answer_ids
exercise_choices = choices.order("choice_position ASC")
ex_choice_random_boolean = (exercise_type.present? && exercise_type == 3 && (question.exercise.choice_random)) ? true : false #问题的选项随机打乱
if ex_choice_random_boolean
exercise_choices = exercise_choices.order("RAND()")
exercise_choices = choices.order("RAND()")
else
exercise_choices = choices.order("choice_position ASC")
end
json.question_choices do
json.array! exercise_choices.each_with_index.to_a do |a,index|

Loading…
Cancel
Save