teachers_count = 0 json.data do json.array! @activities do |d| json.id d.id json.name d.name json.days d.days json.teachers_count d.activity_teachers_count teachers_count += d.activity_teachers_count json.return_rate d.return_rate json.students_count d.students_count || 0 json.course_rate d.course_rate json.start_at d.start_at ? d.start_at.to_s(:date) : '' json.clazz_id d.clazz_id json.staff d.staff&.user&.real_name json.staff_manage d.manages.map { |d| d.staff.user.real_name}.uniq.join("、") json.staff_assist d.assists.map { |d| d.staff.user.real_name}.uniq.join("、") json.expert d.experts.pluck(:name).join("、") end end json.totalRow do json.teachers_count teachers_count.to_s end json.code 0 json.count @activities.total_count