From 1773a4a49c64e87332020d4bb9553f672cee20d2 Mon Sep 17 00:00:00 2001 From: SylorHuang Date: Tue, 27 Aug 2019 11:04:53 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=AF=95=E5=8D=B7=E8=AF=84?= =?UTF-8?q?=E9=98=85=E9=A1=B5=E9=9D=A2=E7=9A=84=E7=AD=94=E6=A1=88=E5=86=85?= =?UTF-8?q?=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../exercise_questions/_exercise_questions.json.jbuilder | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/views/exercise_questions/_exercise_questions.json.jbuilder b/app/views/exercise_questions/_exercise_questions.json.jbuilder index bbdf45440..88d4179aa 100644 --- a/app/views/exercise_questions/_exercise_questions.json.jbuilder +++ b/app/views/exercise_questions/_exercise_questions.json.jbuilder @@ -36,6 +36,14 @@ if question.question_type <= 2 #当为选择题或判断题时,只显示选 if exercise_type == 1 || exercise_type == 4 #1为老师,4为试卷截止且答案公开的情况 json.standard_answer standard_answers_array + if question.question_type == 2 #返回答案的文字 + standard_text = standard_answers_array.first.to_i == 1 ? "正确" : "错误" + else + array_text_answer = [] + standard_answers_array.each{|a| array_text_answer.push((a+65).chr)} + standard_text = array_text_answer.join("") + end + json.standard_answer_show standard_text end if exercise_type == 3 || exercise_type == 4 json.user_answer user_answer