diff --git a/app/models/exercise.rb b/app/models/exercise.rb index 0b4aca8eb..f9efabbd8 100644 --- a/app/models/exercise.rb +++ b/app/models/exercise.rb @@ -59,7 +59,7 @@ class Exercise < ApplicationRecord # 根据是否统一发布获取作业的作品列表 def all_works - exercise_users = unified_setting ? exercise_users : + ex_users = unified_setting ? exercise_users : exercise_users.joins("join course_members on exercise_users.user_id=course_members.user_id"). where(course_members: {course_group_id: published_settings.pluck(:course_group_id)}) end diff --git a/app/models/poll.rb b/app/models/poll.rb index d37ea8458..381a7f359 100644 --- a/app/models/poll.rb +++ b/app/models/poll.rb @@ -53,7 +53,7 @@ class Poll < ApplicationRecord # 根据是否统一发布获取作业的作品列表 def all_works - poll_users = unified_setting ? poll_users : + po_users = unified_setting ? poll_users : poll_users.joins("join course_members on poll_users.user_id=course_members.user_id"). where(course_members: {course_group_id: published_settings.pluck(:course_group_id)}) end