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) : '' end end json.totalRow do json.teachers_count teachers_count.to_s end json.code 0 json.count @activities.total_count