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)

    course_target = @course_target_count_map.fetch(ec_year.id, 0)
    graduation_subitem = @graduation_subitem_count_map.fetch(ec_year.id, 0)
    achieved_course = achieved_graduation_course_count(ec_year)
    achieved_objective = achieved_graduation_objective_count(ec_year)

    json.course_target_count course_target
    json.graduation_subitem_count graduation_subitem
    json.achieved_graduation_course_count achieved_course
    json.achieved_graduation_objective_count achieved_objective
    json.status graduation_subitem == achieved_objective ? 'achieved' : 'not_achieved'
  end
end