超级管理员的课堂列表调整

dev_aliyun
cxt 5 years ago
parent b1b96a4149
commit 07512a578d

@ -508,7 +508,7 @@ class Course < ActiveRecord::Base
# 课堂实训作业的评测次数 # 课堂实训作业的评测次数
def evaluate_count def evaluate_count
course_user_ids = self.members.map(&:user_id) course_user_ids = self.students.map(&:user_id)
shixun_ids = self.homework_commons.joins(:homework_commons_shixuns).where(homework_type: 4).pluck(:shixun_id) shixun_ids = self.homework_commons.joins(:homework_commons_shixuns).where(homework_type: 4).pluck(:shixun_id)
return 0 if shixun_ids.blank? return 0 if shixun_ids.blank?
Game.joins(:challenge).where(challenges: {shixun_id: shixun_ids}, games: {user_id: course_user_ids}).sum(:evaluate_count) Game.joins(:challenge).where(challenges: {shixun_id: shixun_ids}, games: {user_id: course_user_ids}).sum(:evaluate_count)

Loading…
Cancel
Save