From f72b948be5e483024b9e6bad258e17de458b12ad Mon Sep 17 00:00:00 2001 From: SylorHuang Date: Wed, 28 Aug 2019 15:24:42 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E8=AF=95=E5=8D=B7=E7=9A=84=E5=A4=9A?= =?UTF-8?q?=E9=80=89=E9=A2=98=E8=80=81=E6=95=B0=E6=8D=AE=E8=BD=AC=E5=8C=96?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/exercise_questions/_exercise_questions.json.jbuilder | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/views/exercise_questions/_exercise_questions.json.jbuilder b/app/views/exercise_questions/_exercise_questions.json.jbuilder index ca8ea7e6b..cbf34c301 100644 --- a/app/views/exercise_questions/_exercise_questions.json.jbuilder +++ b/app/views/exercise_questions/_exercise_questions.json.jbuilder @@ -49,6 +49,9 @@ if question.question_type <= 2 #当为选择题或判断题时,只显示选 if question.question_type == 2 #返回答案的文字 standard_text = standard_answers_array.first.to_i == 1 ? "正确" : "错误" else + if question.question_type == 1 && standard_answers_array.size == 1 + standard_answers_array = standard_answers_array.first.split("") + end array_text_answer = [] standard_answers_array.each{|a| array_text_answer.push((a+64).chr)} standard_text = array_text_answer.join("") From f4a2fb81c6879b292c1219585d79b8e0543f7042 Mon Sep 17 00:00:00 2001 From: SylorHuang Date: Wed, 28 Aug 2019 15:28:02 +0800 Subject: [PATCH 2/5] fixubg --- app/views/exercise_questions/_exercise_questions.json.jbuilder | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/exercise_questions/_exercise_questions.json.jbuilder b/app/views/exercise_questions/_exercise_questions.json.jbuilder index cbf34c301..7565a3ab0 100644 --- a/app/views/exercise_questions/_exercise_questions.json.jbuilder +++ b/app/views/exercise_questions/_exercise_questions.json.jbuilder @@ -50,7 +50,7 @@ if question.question_type <= 2 #当为选择题或判断题时,只显示选 standard_text = standard_answers_array.first.to_i == 1 ? "正确" : "错误" else if question.question_type == 1 && standard_answers_array.size == 1 - standard_answers_array = standard_answers_array.first.split("") + standard_answers_array = standard_answers_array.first.to_s.split("") end array_text_answer = [] standard_answers_array.each{|a| array_text_answer.push((a+64).chr)} From c45601ebcfdf2ab8bfbdc6dd497345f20ebfb019 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Wed, 28 Aug 2019 15:32:00 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E9=A2=98=E5=BA=93=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users/question_banks_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/users/question_banks_controller.rb b/app/controllers/users/question_banks_controller.rb index 0dc4a3f3f..bb822c8c8 100644 --- a/app/controllers/users/question_banks_controller.rb +++ b/app/controllers/users/question_banks_controller.rb @@ -36,8 +36,8 @@ class Users::QuestionBanksController < Users::BaseController .group('graduation_tasks.gtask_bank_id').count when 'gtopic' then StudentGraduationTopic.joins(:graduation_topic) - .where(gtopic_banks: { gtopic_bank_id: question_bank_ids }).where('status != 0') - .group('gtopic_banks.gtopic_bank_id').count + .where(graduation_topics: { gtopic_bank_id: question_bank_ids }).where('status != 0') + .group('graduation_topics.gtopic_bank_id').count end end From e7d419593f05ecacaad50b78783813c21e68c89f Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Wed, 28 Aug 2019 15:34:02 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E9=A2=98=E5=BA=93=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users/question_banks_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/users/question_banks_controller.rb b/app/controllers/users/question_banks_controller.rb index bb822c8c8..d0a331291 100644 --- a/app/controllers/users/question_banks_controller.rb +++ b/app/controllers/users/question_banks_controller.rb @@ -36,7 +36,7 @@ class Users::QuestionBanksController < Users::BaseController .group('graduation_tasks.gtask_bank_id').count when 'gtopic' then StudentGraduationTopic.joins(:graduation_topic) - .where(graduation_topics: { gtopic_bank_id: question_bank_ids }).where('status != 0') + .where(graduation_topics: { gtopic_bank_id: question_bank_ids }).where('student_graduation_topics.status = 1') .group('graduation_topics.gtopic_bank_id').count end end From 07c1cdb7303a20127016a14d9ad6e14e06e73c71 Mon Sep 17 00:00:00 2001 From: SylorHuang Date: Wed, 28 Aug 2019 15:41:45 +0800 Subject: [PATCH 5/5] change to_i --- app/views/exercise_questions/_exercise_questions.json.jbuilder | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/exercise_questions/_exercise_questions.json.jbuilder b/app/views/exercise_questions/_exercise_questions.json.jbuilder index 7565a3ab0..bf5e02b3c 100644 --- a/app/views/exercise_questions/_exercise_questions.json.jbuilder +++ b/app/views/exercise_questions/_exercise_questions.json.jbuilder @@ -53,7 +53,7 @@ if question.question_type <= 2 #当为选择题或判断题时,只显示选 standard_answers_array = standard_answers_array.first.to_s.split("") end array_text_answer = [] - standard_answers_array.each{|a| array_text_answer.push((a+64).chr)} + standard_answers_array.each{|a| array_text_answer.push((a.to_i+64).chr)} standard_text = array_text_answer.join("") end json.standard_answer_show standard_text