json.count @count json.ec_years do json.array! @ec_years do |ec_year| json.extract! ec_year, :id, :year json.student_count @student_count_map.fetch(ec_year.id, 0) json.training_subitem_count @training_subitem_count_map.fetch(ec_year.id, 0) json.graduation_requirement_count @graduation_requirement_count_map.fetch(ec_year.id, 0) json.course_count @course_count_map.fetch(ec_year.id, 0) json.course_target_count @course_target_count_map.fetch(ec_year.id, 0) json.graduation_subitem_count @graduation_subitem_count_map.fetch(ec_year.id, 0) end end