You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
educoder/app/views/ecs/ec_courses/index.json.jbuilder

26 lines
1018 B

json.count @count
json.ec_courses do
json.array! @ec_courses do |ec_course|
json.extract! ec_course, :id, :name, :ec_year_id
json.course_evaluation_count @evaluation_count_map[ec_course.id]
json.course_achievement_method_count @achievement_method_count_map[ec_course.id]
# 课程目标
json.course_target_count ec_course.complete_target_count
json.course_target_count @target_count_map[ec_course.id]
# 毕业要求指导点
json.graduation_subitem_count @graduation_subitem_count_map[ec_course.id]
json.completed_graduation_subitem_count @completed_subitem_count_map[ec_course.id]
# 达成状态
status = if @target_count_map[ec_course.id].to_i.zero?
''
else
ec_course.complete_target_count == @target_count_map[ec_course.id].to_i ? 'achieved' : 'not_achieved'
end
json.status status
json.course_managers ec_course.course_managers, partial: 'ecs/shared/user', as: :user
end
end