You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
educoder/app/views/subjects/show.json.jbuilder

37 lines
1.5 KiB

json.(@subject, :id, :name, :description, :learning_notes, :stages_count, :stage_shixuns_count, :shixuns_count, :excellent)
json.challenge_choose_count @subject.subject_challenge_choose_count
json.challenges_count @subject.subject_challenge_count
json.subject_score @subject.all_score
json.member_count @subject.member_count
json.is_collect @user&.is_collect?(@subject)
json.allow_delete (@subject.status != 2 && @is_creator) || @user.admin?
json.publish_status publish_status(@subject, @is_manager)
json.public_status public_status(@subject, @is_manager, @user)
json.allow_statistics @is_manager
json.allow_send @user.logged?
json.allow_visit @subject.status > 1 || @is_manager
json.allow_add_member @is_manager
json.is_creator @is_creator
json.cover url_to_avatar(@subject)
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)
json.start_date course.start_date
json.end_date course.end_date
json.student_count course.students.count
json.course_identity @user.course_identity(course)
json.course_status subject_course_status course
end
if @subject.max_course_end_date.nil? || @subject.max_course_end_date < Date.today
json.student_count @subject.student_count
json.participant_count @subject.participant_count
json.has_participate @subject.has_participate?
end
end