From 98ea54de41236d53b984df22d2162f86b4778433 Mon Sep 17 00:00:00 2001
From: SylorHuang <sylor_huang@126.com>
Date: Tue, 16 Jul 2019 16:15:13 +0800
Subject: [PATCH] =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E7=BB=93=E6=9E=9C=E9=A1=B5?=
 =?UTF-8?q?=E9=9D=A2=E7=9A=84=E9=80=89=E6=8B=A9=E5=BA=8F=E5=8F=B7?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 app/views/exercises/exercise_result.json.jbuilder | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/app/views/exercises/exercise_result.json.jbuilder b/app/views/exercises/exercise_result.json.jbuilder
index 7f2d871fc..38b03cccb 100644
--- a/app/views/exercises/exercise_result.json.jbuilder
+++ b/app/views/exercises/exercise_result.json.jbuilder
@@ -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]