|
|
|
@ -46,6 +46,10 @@ class Subject < ApplicationRecord
|
|
|
|
|
courses.where("start_date <= '#{Date.today}' and end_date >= '#{Date.today}'").count > 0
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def has_participate?
|
|
|
|
|
subject_appointments.exists?(user_id: User.current.id)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
# 挑战过路径的成员数(金课统计去重后的报名人数)
|
|
|
|
|
def member_count
|
|
|
|
|
excellent ? CourseMember.where(role: 4, course_id: courses.pluck(:id)).pluck(:user_id).length : shixuns.pluck(:myshixuns_count).sum
|
|
|
|
|