From 61f491bdde789056d5cab606300a4b8467126e67 Mon Sep 17 00:00:00 2001 From: SylorHuang Date: Thu, 20 Jun 2019 19:46:35 +0800 Subject: [PATCH 1/2] fix bug --- app/controllers/exercise_answers_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/exercise_answers_controller.rb b/app/controllers/exercise_answers_controller.rb index 68ba83276..c709980f9 100644 --- a/app/controllers/exercise_answers_controller.rb +++ b/app/controllers/exercise_answers_controller.rb @@ -8,7 +8,7 @@ class ExerciseAnswersController < ApplicationController q_type = @exercise_question.question_type #试卷的类型 choice_id = params[:exercise_choice_id].present? ? params[:exercise_choice_id] : "" answer_text = params[:answer_text].present? ? params[:answer_text] : "" #为字符串 - if q_type < 4 && choice_id.blank? + if q_type < 4 && (q_type != 1) && choice_id.blank? normal_status(-1,"请选择序号") else ea = @exercise_question.exercise_answers.search_answer_users("user_id",current_user.id) #试卷的当前用户的答案 From 010d2f4049ada3e9abeee1f20427c31503a348aa Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Thu, 20 Jun 2019 19:52:12 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E9=80=89=E9=A2=98=E6=8B=92=E7=BB=9D?= =?UTF-8?q?=E5=90=8E=E9=80=89=E9=A2=98=E7=8A=B6=E6=80=81=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/graduation_topic.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/models/graduation_topic.rb b/app/models/graduation_topic.rb index 5a2a630e5..294bfa785 100644 --- a/app/models/graduation_topic.rb +++ b/app/models/graduation_topic.rb @@ -50,10 +50,10 @@ class GraduationTopic < ApplicationRecord def student_graduation_topic_status sgt = self.student_graduation_topics status = - if sgt.is_accepting.count == 0 - 2 - elsif sgt.is_refused.count == self.student_graduation_topics.size + if sgt.where(status: [0, 1]).count.zero? 0 + elsif sgt.is_accepting.count.zero? + 2 else 1 end