json.courses @courses do |course| json.course_id course.id json.course_name course.name json.created_at course.created_at end json.stages @subject.stages.includes(shixuns: [user: :user_extension]) do |stage| index = 1 json.shixuns stage.shixuns do |shixun| if shixun.status == 2 && !shixun.is_jupyter && @all_shixun_ids.include?(shixun.id) json.shixun_id shixun.id json.id shixun.id json.identifier shixun.identifier json.shixun_name "#{stage.position}-#{index} #{shixun.name}" json.title shixun.name json.level level_to_s(shixun.trainee) json.study_count shixun.myshixuns_count json.author_name shixun.user.real_name json.author_img url_to_avatar(shixun.user) end index += 1 end end