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.
27 lines
898 B
27 lines
898 B
class Ecs::ReachEvaluationsController < Ecs::BaseController
|
|
|
|
def show
|
|
preload = { ec_graduation_subitems: { ec_course_supports: [:ec_course, :ec_graduation_requirement_calculation] } }
|
|
@graduation_requirements = current_year.ec_graduation_requirements.includes(preload)
|
|
|
|
respond_to do |format|
|
|
format.json
|
|
format.xlsx do
|
|
filename = "#{current_year.year}届达成度-毕业要求综合评价报表_#{Time.current.strftime('%Y%m%d%H%M%S')}.xlsx"
|
|
render xlsx: 'show', filename: filename
|
|
end
|
|
end
|
|
end
|
|
|
|
def create
|
|
relations = current_year.ec_graduation_requirements.joins(ec_graduation_subitems: :ec_course_support)
|
|
ec_course_ids = relations.pluck('ec_course_supports.ec_course_id').uniq
|
|
|
|
EcCourse.where(id: ec_course_ids).each do |ec_course|
|
|
Ecs::CalculateCourseEvaluationService.call(ec_course)
|
|
end
|
|
|
|
render_ok
|
|
end
|
|
end
|