统计结果页面的选择序号

dev_forum
SylorHuang 6 years ago
parent 8fd8da2e8c
commit 98ea54de41

@ -34,9 +34,16 @@ json.commit_results do
json.effictive_counts q[:ques_effictive_counts]
if q[:type] != Exercise::PRACTICAL
json.ques_details do
json.array! q[:ques_details] do |d|
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 = ""
end
json.choice_position d[:choice_position]
json.choice_text d[:choice_text]
json.choice_text "#{ques_index}.#{d[:choice_text]}"
json.choice_users_count d[:choice_users_count]
json.choice_percent d[:choice_percent]
json.choice_right_boolean d[:right_answer]
@ -50,9 +57,9 @@ json.commit_results do
json.challenge_position cha[:cha_position]
json.challenge_percent cha[:cha_percent]
json.challenge_details do
json.array! cha[:cha_details] do |ch|
json.array! cha[:cha_details].each_with_index.to_a do |ch,index|
json.choice_position ch[:choice_position]
json.choice_text ch[:choice_text]
json.choice_text "#{(index+1).to_s}.#{ch[:choice_text]}"
json.choice_users_count ch[:choice_users_count]
json.choice_percent ch[:choice_percent]
json.choice_right_boolean ch[:right_answer]

Loading…
Cancel
Save