dev_daiao
parent
b640198fdc
commit
3f0e5b95ec
@ -0,0 +1,22 @@
|
||||
class Subjects::DataStatisticService < ApplicationService
|
||||
attr_reader :subject, :user
|
||||
def initialize(subject, user)
|
||||
@subject = subject
|
||||
@user = user
|
||||
@shixuns = subject.shixuns
|
||||
end
|
||||
|
||||
# 学习总人数
|
||||
def study_count
|
||||
@shixuns.includes(:myshixuns).map{|shixun| shixun.myshixuns.pluck(:user_id)}.uniq
|
||||
end
|
||||
|
||||
# 课堂学习人数
|
||||
def course_study_count
|
||||
# 实训作业
|
||||
sw_user_ids = StudentWork.where.not(myshixun_id: nil).pluck(:user_id)
|
||||
# 试卷的实训题
|
||||
esa_user_ids = ExerciseShixunAnswer.where()
|
||||
end
|
||||
|
||||
end
|
Loading…
Reference in new issue