|
|
|
@ -508,7 +508,7 @@ class Course < ActiveRecord::Base
|
|
|
|
|
|
|
|
|
|
# 课堂实训作业的评测次数
|
|
|
|
|
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)
|
|
|
|
|
return 0 if shixun_ids.blank?
|
|
|
|
|
Game.joins(:challenge).where(challenges: {shixun_id: shixun_ids}, games: {user_id: course_user_ids}).sum(:evaluate_count)
|
|
|
|
|