Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop
commit
0560d0e2c5
@ -0,0 +1,20 @@
|
|||||||
|
wb = xlsx_package.workbook
|
||||||
|
wb.add_worksheet(name: "统计总表") do |sheet|
|
||||||
|
sheet.add_row %w(ID 单位名称 教师总人数 学生总人数 课堂总数 正在进行课堂数 实训作业总数 其它作业总数 动态时间)
|
||||||
|
|
||||||
|
total = @schools.count
|
||||||
|
buffer_size = 500
|
||||||
|
times = total % 500 > 0 ? total / 500 + 1 : total / 500
|
||||||
|
|
||||||
|
times.times do |index|
|
||||||
|
schools = @schools.limit(buffer_size).offset(index * buffer_size)
|
||||||
|
|
||||||
|
schools.each do |school|
|
||||||
|
sheet.add_row([
|
||||||
|
school['id'].to_s, school['name'].to_s, school['teacher_count'].to_s, school['student_count'].to_s,
|
||||||
|
school['course_count'].to_s, school['active_course_count'].to_s, school['homework_count'].to_s,
|
||||||
|
school['other_homework_count'].to_s, format_time(school['nearly_course_time'])
|
||||||
|
])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in new issue