ec_year = @_current_year json.reach_threshold ec_year.calculation_value maximum_course_support_count = 0 json.graduation_requirements do json.array! @graduation_requirements do |requirement| json.extract! requirement, :id, :position json.graduation_subitems do json.array! requirement.ec_graduation_subitems do |subitem| json.extract! subitem, :id, :position reach_criteria_total = 0.0 actually_reach_total = 0.0 json.course_supports do json.array! subitem.ec_course_supports do |support| json.id support.id json.course_id support.ec_course.id json.course_name support.ec_course.name reach_criteria = support.weights.to_f * ec_year.calculation_value.to_f actually_reach = support.ec_graduation_requirement_calculation&.real_value.to_f reach_criteria_total += reach_criteria actually_reach_total += actually_reach json.reach_criteria format('%.03f', reach_criteria) json.actually_reach format('%.03f', actually_reach) end end json.reach_criteria format('%.03f', reach_criteria_total) json.actually_reach format('%.03f', actually_reach_total) size = subitem.ec_course_supports.size maximum_course_support_count = size if size > maximum_course_support_count json.course_support_count size json.status actually_reach_total >= reach_criteria_total ? 'achieved' : 'not_achieved' end end end end json.maximum_course_support_count maximum_course_support_count