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