Merge remote-tracking branch 'origin/dev_aliyun' into dev_aliyun

dev_hs
杨树明 5 years ago
commit 41503a8be1

@ -39,6 +39,11 @@ class Subject < ApplicationRecord
courses.pluck(:end_date).max
end
# 是否有已开课的课堂
def has_course_start?
courses.where("start_date <= '#{Date.today}' and end_date >= '#{Date.today}'").count > 0
end
# 挑战过路径的成员数(金课统计去重后的报名人数)
def member_count
excellent && CourseMember.where(role: 4, course_id: courses.pluck(:id)).pluck(:user_id).uniq.length > shixuns.pluck(:myshixuns_count).sum ?

@ -14,6 +14,7 @@ json.allow_add_member @is_manager
json.is_creator @is_creator
if @subject.excellent
json.has_start @subject.has_course_start?
json.courses @courses do |course|
json.course_id course.id
json.first_category_url module_url(course.none_hidden_course_modules.first, course)

Loading…
Cancel
Save