@ -84,6 +84,7 @@ class SubjectsController < ApplicationController
@is_manager = @user.manager_of_subject?(@subject)
# 合作团队
@shixuns = @subject.shixuns.published.pluck(:id)
@courses = @subject.courses id if @subject.excellent
# 访问数变更
@subject.increment!(:visits)
@ -16,4 +16,6 @@ module SubjectsHelper
ChallengeTag.joins("join games on challenge_tags.challenge_id = games.challenge_id").
where(challenge_id: challenge_ids, games: {status: 2, user_id: user_id}).pluck("challenge_tags.name").uniq
end
@ -13,5 +13,11 @@ json.allow_visit @subject.status > 1 || @is_manager
json.allow_add_member @is_manager
if @subject.excellent
@courses.each do |course|
json.start_date course.start_date.beginning_of_day
json.end_date course.end_date.end_of_day
json.student_count course.students.count
json.course_identity @user.course_identity(course)
json.course_status course