|
|
@ -3,9 +3,11 @@ wb = xlsx_package.workbook
|
|
|
|
wb.styles do |s|
|
|
|
|
wb.styles do |s|
|
|
|
|
blue_cell = s.add_style :bg_color => "FAEBDC", :sz => 10,:height => 25,:b => true, :border => { :style => :thin, :color =>"000000" },:alignment => {wrap_text: true,:horizontal => :center,:vertical => :center}
|
|
|
|
blue_cell = s.add_style :bg_color => "FAEBDC", :sz => 10,:height => 25,:b => true, :border => { :style => :thin, :color =>"000000" },:alignment => {wrap_text: true,:horizontal => :center,:vertical => :center}
|
|
|
|
wb.add_worksheet(name: "课堂列表") do |sheet|
|
|
|
|
wb.add_worksheet(name: "课堂列表") do |sheet|
|
|
|
|
sheet.add_row %w(ID 课堂名称 老师 学生 分班数 资源 公告 视频 普通作业 分组作业 实训作业 实训作业已发布数 作品数 试卷 评测次数 私有 状态 单位 部门 创建者 创建时间 动态时间), :height => 25,:style => blue_cell
|
|
|
|
sheet.add_row %w(ID 课堂名称 老师 学生 分班数 资源 公告 视频 视频学习时长 直播 普通作业 分组作业 实训作业 实训作业已发布数 作品数 试卷 评测次数 讨论数 私有 状态 单位 部门 创建者 创建时间), :height => 25,:style => blue_cell
|
|
|
|
|
|
|
|
|
|
|
|
@courses.each do |course|
|
|
|
|
@courses.each do |course|
|
|
|
|
|
|
|
|
course_board = course.course_board
|
|
|
|
|
|
|
|
topic_count = course_board.present? ? course_board.messages.size : 0
|
|
|
|
data = [
|
|
|
|
data = [
|
|
|
|
course.id,
|
|
|
|
course.id,
|
|
|
|
course.name,
|
|
|
|
course.name,
|
|
|
@ -15,6 +17,8 @@ wb.styles do |s|
|
|
|
|
get_attachment_count(course, 0),
|
|
|
|
get_attachment_count(course, 0),
|
|
|
|
course.informs.size,
|
|
|
|
course.informs.size,
|
|
|
|
course.course_videos.size,
|
|
|
|
course.course_videos.size,
|
|
|
|
|
|
|
|
course.course_videos.map{|cv| cv.watch_course_videos.map(&:total_duration).sum }.sum.round,
|
|
|
|
|
|
|
|
course.live_links.size,
|
|
|
|
course.course_homework_count("normal"),
|
|
|
|
course.course_homework_count("normal"),
|
|
|
|
course.course_homework_count("group"),
|
|
|
|
course.course_homework_count("group"),
|
|
|
|
course.course_homework_count("practice"),
|
|
|
|
course.course_homework_count("practice"),
|
|
|
@ -22,13 +26,13 @@ wb.styles do |s|
|
|
|
|
course.student_works_count,
|
|
|
|
course.student_works_count,
|
|
|
|
course.exercises_count,
|
|
|
|
course.exercises_count,
|
|
|
|
course.evaluate_count,
|
|
|
|
course.evaluate_count,
|
|
|
|
|
|
|
|
topic_count,
|
|
|
|
course.is_public == 1 ? "--" : "√",
|
|
|
|
course.is_public == 1 ? "--" : "√",
|
|
|
|
course.is_end ? "已结束" : "正在进行",
|
|
|
|
course.is_end ? "已结束" : "正在进行",
|
|
|
|
course.school&.name,
|
|
|
|
course.school&.name,
|
|
|
|
course.teacher&.department_name,
|
|
|
|
course.teacher&.department_name,
|
|
|
|
course.teacher&.real_name,
|
|
|
|
course.teacher&.real_name,
|
|
|
|
course.created_at&.strftime('%Y-%m-%d %H:%M'),
|
|
|
|
course.created_at&.strftime('%Y-%m-%d %H:%M'),
|
|
|
|
course.max_activity_time ? course.max_activity_time&.strftime('%Y-%m-%d %H:%M') : "--"
|
|
|
|
|
|
|
|
]
|
|
|
|
]
|
|
|
|
sheet.add_row(data)
|
|
|
|
sheet.add_row(data)
|
|
|
|
end
|
|
|
|
end
|
|
|
|