From cd69eaeaafb81aab9862a15f0c9bacf4c05a4570 Mon Sep 17 00:00:00 2001
From: cxt <853663049@qq.com>
Date: Tue, 24 Mar 2020 21:46:55 +0800
Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 app/helpers/exercises_helper.rb                  | 4 ++--
 app/views/exercises/exercise_lists.json.jbuilder | 3 ++-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/app/helpers/exercises_helper.rb b/app/helpers/exercises_helper.rb
index ae41816ba..01b0bab61 100644
--- a/app/helpers/exercises_helper.rb
+++ b/app/helpers/exercises_helper.rb
@@ -712,9 +712,9 @@ module ExercisesHelper
       course_group = course.course_groups.by_group_ids(current_user_group_id)
       current_user_group_name = course_group.first.name if course_group.present?
     end
-    exercise_answer_ids = ex_user.user.exercise_answers.where(exercise_question_id: subject_question_ids).pluck(:id)
 
-    if ex_user.subjective_score > 0.0 || ex_user.exercise_user_scores.size > 0 || ExerciseAnswerComment.where(exercise_answer_id: exercise_answer_ids).exists?
+    if ex_user.subjective_score > 0.0 || ex_user.exercise_user_scores.size > 0 ||
+      ExerciseAnswerComment.where(exercise_answer_id: ex_user.user.exercise_answers.where(exercise_question_id: subject_question_ids)).exists?
       teacher_review = true
     else
       teacher_review = false
diff --git a/app/views/exercises/exercise_lists.json.jbuilder b/app/views/exercises/exercise_lists.json.jbuilder
index 87a80f11e..a5ad1f340 100644
--- a/app/views/exercises/exercise_lists.json.jbuilder
+++ b/app/views/exercises/exercise_lists.json.jbuilder
@@ -38,7 +38,8 @@ if @current_user_ex_answers.present?
   json.current_answer_user do
     json.partial! "exercises/exercise_user",locals: {exercise_user:@current_user_ex_answers.first, subjective_type:@subjective_type,
                                                      user_status:@exercise_current_user_status, exercise:@exercise,
-                                                     question_ids: @exercise.exercise_questions.pluck(:id)}
+                                                     question_ids: @exercise.exercise_questions.pluck(:id),
+                                                     subject_question_ids: @exercise.subject_question_ids}
   end
 end