dev_SaaS
cxt 6 years ago
parent 81ab00f482
commit 649e2a7ba6

@ -102,13 +102,9 @@ class EcCoursesController < ApplicationController
end end
def ec_course_support_setting_data def ec_course_support_setting_data
respond_to do |format| course_targets = @ec_course.ec_course_targets.includes(:ec_graduation_subitems)
format.json { json_data = target_list_data(course_targets)
course_targets = @ec_course.ec_course_targets.includes(:ec_graduation_subitems) render :json => json_data
json_data = target_list_data(course_targets)
render :json => json_data
}
end
end end
# 课程目标配置的更新操作() # 课程目标配置的更新操作()

@ -58,38 +58,34 @@ class EcYearsController < ApplicationController
end end
def student_lists_data def student_lists_data
respond_to do |format| template_file = EcTemplate.find_by_name "学生列表导入模板"
format.json { if template_file.present?
template_file = EcTemplate.find_by_name "学生列表导入模板" file = template_file.attachments.first
if template_file.present? template_url = "/attachments/download/#{file.id}/#{file.filename}"
file = template_file.attachments.first else
template_url = "/attachments/download/#{file.id}/#{file.filename}" template_url = "javascript:void(0);"
else end
template_url = "javascript:void(0);"
end
students = @year.ec_year_students students = @year.ec_year_students
show_name = @year.ec_year_students.where(:name => nil).count == 0 show_name = @year.ec_year_students.where(:name => nil).count == 0
page = params[:page] || 1 page = params[:page] || 1
total_student = students.count total_student = students.count
total_page = (total_student / 50.0).ceil total_page = (total_student / 50.0).ceil
students = paginateHelper students, 50 students = paginateHelper students, 50
ec_students = [] ec_students = []
students.each_with_index do |student, index| students.each_with_index do |student, index|
student = {index: (50*(page.to_i - 1) + index + 1), student = {index: (50*(page.to_i - 1) + index + 1),
student_name: student.name, student_name: student.name,
student_id: student.student_id} student_id: student.student_id}
ec_students << student ec_students << student
end end
import_url = "/ec_major_schools/#{@ec_major_school.id}/academic_years/#{@year.id}/import_students" import_url = "/ec_major_schools/#{@ec_major_school.id}/academic_years/#{@year.id}/import_students"
render :json => {template_url: template_url, ec_students: ec_students, total_page: total_page, import_url: import_url, render :json => {template_url: template_url, ec_students: ec_students, total_page: total_page, import_url: import_url,
show_name: show_name, :total_student => total_student, :is_manager => @template_major} show_name: show_name, :total_student => total_student, :is_manager => @template_major}
}
end
end end
# DELETE: /ec_major_schools/:major_id/academic_years/:year_id/destroy_students # DELETE: /ec_major_schools/:major_id/academic_years/:year_id/destroy_students

Loading…
Cancel
Save