|
|
|
@ -2381,430 +2381,431 @@ class CoursesController < ApplicationController
|
|
|
|
|
def member_to_xls homeworks, exercises, tasks, course, members, groups
|
|
|
|
|
xls_report = StringIO.new
|
|
|
|
|
book = Spreadsheet::Workbook.new
|
|
|
|
|
sheet1 = book.create_worksheet :name => "总成绩"
|
|
|
|
|
blue = Spreadsheet::Format.new :color => :blue, :weight => :bold, :size => 10
|
|
|
|
|
#sheet1.row(0).default_format = blue
|
|
|
|
|
#sheet1.row(0).concat([l(:excel_user_id),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_mail),l(:excel_class),l(:excel_f_score),l(:excel_commit_time)])
|
|
|
|
|
# sheet1 = book.create_worksheet :name => "总成绩"
|
|
|
|
|
# blue = Spreadsheet::Format.new :color => :blue, :weight => :bold, :size => 10
|
|
|
|
|
# #sheet1.row(0).default_format = blue
|
|
|
|
|
# #sheet1.row(0).concat([l(:excel_user_id),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_mail),l(:excel_class),l(:excel_f_score),l(:excel_commit_time)])
|
|
|
|
|
teacher_co = (searchTeacherAndAssistant course).map{|member| member.user.show_real_name}.join('、')
|
|
|
|
|
sheet1[0,0] = "课程编号"
|
|
|
|
|
sheet1[0,1] = course.id
|
|
|
|
|
sheet1[1,0] = "课程名称"
|
|
|
|
|
sheet1[1,1] = course.name
|
|
|
|
|
sheet1[2,0] = "教师团队"
|
|
|
|
|
sheet1[2,1] = teacher_co
|
|
|
|
|
sheet1[3,0] = "主讲教师"
|
|
|
|
|
sheet1[3,1] = course.teacher.show_real_name
|
|
|
|
|
sheet1[4,0] = "排名"
|
|
|
|
|
sheet1[4,1] = "学生姓名"
|
|
|
|
|
sheet1[4,2] = "昵称"
|
|
|
|
|
sheet1[4,3] = "邮箱"
|
|
|
|
|
sheet1[4,4] = "学号"
|
|
|
|
|
sheet1[4,5] = "分班"
|
|
|
|
|
current_col = 5
|
|
|
|
|
homeworks.where(:homework_type => 4).each do |homework|
|
|
|
|
|
sheet1[4,current_col+=1] = "#{homework.name}"
|
|
|
|
|
end
|
|
|
|
|
for i in 0 ... homeworks.where(:homework_type => 1).size
|
|
|
|
|
sheet1[4,current_col+=1] = "普通作业第"+(i+1).to_s+"次"
|
|
|
|
|
end
|
|
|
|
|
for i in 0 ... homeworks.where(:homework_type => 3).size
|
|
|
|
|
sheet1[4,current_col+=1] = "分组作业第"+(i+1).to_s+"次"
|
|
|
|
|
end
|
|
|
|
|
for i in 0 ... exercises.size
|
|
|
|
|
sheet1[4,current_col+=1] = "试卷第"+(i+1).to_s+"次"
|
|
|
|
|
end
|
|
|
|
|
for i in 0 ... tasks.size
|
|
|
|
|
sheet1[4,current_col+=1] = "毕设任务第"+(i+1).to_s+"次"
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
sheet1[4,current_col+=1] = "实训作业总得分"
|
|
|
|
|
sheet1[4,current_col+=1] = "普通作业总得分"
|
|
|
|
|
sheet1[4,current_col+=1] = "分组作业总得分"
|
|
|
|
|
sheet1[4,current_col+=1] = "试卷总得分"
|
|
|
|
|
if tasks.count > 0
|
|
|
|
|
sheet1[4,current_col+=1] = "毕设任务总得分"
|
|
|
|
|
end
|
|
|
|
|
#sheet1[6,homeworks.count+6] = "社区得分"
|
|
|
|
|
sheet1[4,current_col+=1] = "总得分"
|
|
|
|
|
count_row = 5
|
|
|
|
|
members.each_with_index do |member, i|
|
|
|
|
|
column = 0
|
|
|
|
|
sheet1[count_row,column]= i+1
|
|
|
|
|
sheet1[count_row,column+=1] = member.user.show_real_name
|
|
|
|
|
sheet1[count_row,column+=1] = member.user.login
|
|
|
|
|
sheet1[count_row,column+=1] = member.user.mail
|
|
|
|
|
sheet1[count_row,column+=1] = member.user.user_extensions.student_id
|
|
|
|
|
sheet1[count_row,column+=1] = member.course_group_id == 0 ? "暂无" : member.course_group.name
|
|
|
|
|
# current_col = 5
|
|
|
|
|
shixun_score = 0
|
|
|
|
|
homeworks.where(:homework_type => 4).includes(:score_student_works).each do |homework|
|
|
|
|
|
student_works = homework.score_student_works.select{|work| work.user_id == member.user.id}
|
|
|
|
|
if student_works.empty?
|
|
|
|
|
sheet1[count_row,column+=1] = 0
|
|
|
|
|
else
|
|
|
|
|
work_score = student_works.first.work_score.nil? ? 0 : student_works.first.work_score
|
|
|
|
|
sheet1[count_row,column+=1] = work_score < 0 ? 0 : work_score.round(1)
|
|
|
|
|
shixun_score += work_score < 0 ? 0 : work_score.round(1)
|
|
|
|
|
end
|
|
|
|
|
# current_col += 1
|
|
|
|
|
# sheet1[0,0] = "课程编号"
|
|
|
|
|
# sheet1[0,1] = course.id
|
|
|
|
|
# sheet1[1,0] = "课程名称"
|
|
|
|
|
# sheet1[1,1] = course.name
|
|
|
|
|
# sheet1[2,0] = "教师团队"
|
|
|
|
|
# sheet1[2,1] = teacher_co
|
|
|
|
|
# sheet1[3,0] = "主讲教师"
|
|
|
|
|
# sheet1[3,1] = course.teacher.show_real_name
|
|
|
|
|
# sheet1[4,0] = "排名"
|
|
|
|
|
# sheet1[4,1] = "学生姓名"
|
|
|
|
|
# sheet1[4,2] = "昵称"
|
|
|
|
|
# sheet1[4,3] = "邮箱"
|
|
|
|
|
# sheet1[4,4] = "学号"
|
|
|
|
|
# sheet1[4,5] = "分班"
|
|
|
|
|
# current_col = 5
|
|
|
|
|
# homeworks.where(:homework_type => 4).each do |homework|
|
|
|
|
|
# sheet1[4,current_col+=1] = "#{homework.name}"
|
|
|
|
|
# end
|
|
|
|
|
# for i in 0 ... homeworks.where(:homework_type => 1).size
|
|
|
|
|
# sheet1[4,current_col+=1] = "普通作业第"+(i+1).to_s+"次"
|
|
|
|
|
# end
|
|
|
|
|
# for i in 0 ... homeworks.where(:homework_type => 3).size
|
|
|
|
|
# sheet1[4,current_col+=1] = "分组作业第"+(i+1).to_s+"次"
|
|
|
|
|
# end
|
|
|
|
|
# for i in 0 ... exercises.size
|
|
|
|
|
# sheet1[4,current_col+=1] = "试卷第"+(i+1).to_s+"次"
|
|
|
|
|
# end
|
|
|
|
|
# for i in 0 ... tasks.size
|
|
|
|
|
# sheet1[4,current_col+=1] = "毕设任务第"+(i+1).to_s+"次"
|
|
|
|
|
# end
|
|
|
|
|
#
|
|
|
|
|
# sheet1[4,current_col+=1] = "实训作业总得分"
|
|
|
|
|
# sheet1[4,current_col+=1] = "普通作业总得分"
|
|
|
|
|
# sheet1[4,current_col+=1] = "分组作业总得分"
|
|
|
|
|
# sheet1[4,current_col+=1] = "试卷总得分"
|
|
|
|
|
# if tasks.count > 0
|
|
|
|
|
# sheet1[4,current_col+=1] = "毕设任务总得分"
|
|
|
|
|
# end
|
|
|
|
|
# #sheet1[6,homeworks.count+6] = "社区得分"
|
|
|
|
|
# sheet1[4,current_col+=1] = "总得分"
|
|
|
|
|
# count_row = 5
|
|
|
|
|
# members.each_with_index do |member, i|
|
|
|
|
|
# column = 0
|
|
|
|
|
# sheet1[count_row,column]= i+1
|
|
|
|
|
# sheet1[count_row,column+=1] = member.user.show_real_name
|
|
|
|
|
# sheet1[count_row,column+=1] = member.user.login
|
|
|
|
|
# sheet1[count_row,column+=1] = member.user.mail
|
|
|
|
|
# sheet1[count_row,column+=1] = member.user.user_extensions.student_id
|
|
|
|
|
# sheet1[count_row,column+=1] = member.course_group_id == 0 ? "暂无" : member.course_group.name
|
|
|
|
|
# # current_col = 5
|
|
|
|
|
# shixun_score = 0
|
|
|
|
|
# homeworks.where(:homework_type => 4).includes(:score_student_works).each do |homework|
|
|
|
|
|
# student_works = homework.score_student_works.select{|work| work.user_id == member.user.id}
|
|
|
|
|
# if student_works.empty?
|
|
|
|
|
# sheet1[count_row,column+=1] = 0
|
|
|
|
|
# else
|
|
|
|
|
# work_score = student_works.first.work_score.nil? ? 0 : student_works.first.work_score
|
|
|
|
|
# sheet1[count_row,column+=1] = work_score < 0 ? 0 : work_score.round(1)
|
|
|
|
|
# shixun_score += work_score < 0 ? 0 : work_score.round(1)
|
|
|
|
|
# end
|
|
|
|
|
# # current_col += 1
|
|
|
|
|
# end
|
|
|
|
|
# common_score = 0
|
|
|
|
|
# homeworks.where(:homework_type => 1).includes(:score_student_works).each do |homework|
|
|
|
|
|
# student_works = homework.score_student_works.select{|work| work.user_id == member.user.id}
|
|
|
|
|
# if student_works.empty?
|
|
|
|
|
# sheet1[count_row,column+=1] = 0
|
|
|
|
|
# else
|
|
|
|
|
# work_score = student_works.first.work_score.nil? ? 0 : student_works.first.work_score
|
|
|
|
|
# sheet1[count_row,column+=1] = work_score < 0 ? 0 : work_score.round(1)
|
|
|
|
|
# common_score += work_score < 0 ? 0 : work_score.round(1)
|
|
|
|
|
# end
|
|
|
|
|
# # current_col += 1
|
|
|
|
|
# end
|
|
|
|
|
# group_score = 0
|
|
|
|
|
# homeworks.where(:homework_type => 3).includes(:score_student_works).each do |homework|
|
|
|
|
|
# student_works = homework.score_student_works.select{|work| work.user_id == member.user.id}
|
|
|
|
|
# if student_works.empty?
|
|
|
|
|
# sheet1[count_row,column+=1] = 0
|
|
|
|
|
# else
|
|
|
|
|
# work_score = student_works.first.work_score.nil? ? 0 : student_works.first.work_score
|
|
|
|
|
# sheet1[count_row,column+=1] = work_score < 0 ? 0 : work_score.round(1)
|
|
|
|
|
# group_score += work_score < 0 ? 0 : work_score.round(1)
|
|
|
|
|
# end
|
|
|
|
|
# # current_col += 1
|
|
|
|
|
# end
|
|
|
|
|
# exercise_score = 0
|
|
|
|
|
# exercises.includes(:score_exercise_users).each do |exercise|
|
|
|
|
|
# exercise_user = exercise.score_exercise_users.select{|work| work.user_id == member.user.id}
|
|
|
|
|
# if exercise_user.empty?
|
|
|
|
|
# sheet1[count_row,column+=1] = 0
|
|
|
|
|
# else
|
|
|
|
|
# work_score = exercise_user.first.score.nil? ? 0 : exercise_user.first.score
|
|
|
|
|
# sheet1[count_row,column+=1] = work_score < 0 ? 0 : work_score.round(1)
|
|
|
|
|
# exercise_score += work_score < 0 ? 0 : work_score.round(1)
|
|
|
|
|
# end
|
|
|
|
|
# # current_col += 1
|
|
|
|
|
# end
|
|
|
|
|
#
|
|
|
|
|
# graduation_score = 0
|
|
|
|
|
# tasks.includes(:graduation_works).each do |task|
|
|
|
|
|
# graduation_works = task.graduation_works.where("user_id = #{member.user.id}")
|
|
|
|
|
# if graduation_works.empty?
|
|
|
|
|
# sheet1[count_row,column+=1] = 0
|
|
|
|
|
# else
|
|
|
|
|
# work_score = graduation_works.first.work_score.nil? ? 0 : graduation_works.first.work_score
|
|
|
|
|
# sheet1[count_row,column+=1] = work_score < 0 ? 0 : work_score.round(1)
|
|
|
|
|
# graduation_score += work_score < 0 ? 0 : work_score.round(1)
|
|
|
|
|
# end
|
|
|
|
|
# # current_col += 1
|
|
|
|
|
# end
|
|
|
|
|
#
|
|
|
|
|
# sum = shixun_score + common_score + group_score + exercise_score + graduation_score
|
|
|
|
|
# sheet1[count_row,column+=1] = shixun_score
|
|
|
|
|
# sheet1[count_row,column+=1] = common_score
|
|
|
|
|
# sheet1[count_row,column+=1] = group_score
|
|
|
|
|
# sheet1[count_row,column+=1] = exercise_score
|
|
|
|
|
# if tasks.count > 0
|
|
|
|
|
# sheet1[count_row,column+=1] = graduation_score
|
|
|
|
|
# end
|
|
|
|
|
# sheet1[count_row,column+=1] = sum.round(1)
|
|
|
|
|
# count_row += 1
|
|
|
|
|
# end
|
|
|
|
|
#
|
|
|
|
|
# if course.course_groups.count > 0
|
|
|
|
|
# sheet = book.create_worksheet :name => "分班信息"
|
|
|
|
|
# sheet.row(0).concat(["课程编号", course.id])
|
|
|
|
|
# sheet.row(1).concat(["课程名称", course.name])
|
|
|
|
|
# sheet.row(2).concat(["教师团队", teacher_co])
|
|
|
|
|
# sheet.row(3).concat(["主讲教师", course.teacher.show_real_name])
|
|
|
|
|
# sheet.row(4).concat(["序号", "分班名称", "邀请码", "学生数量"])
|
|
|
|
|
# current_row = 5
|
|
|
|
|
# course.course_groups.includes(:members).each do |course_group|
|
|
|
|
|
# sheet[current_row,0]= current_row - 4
|
|
|
|
|
# sheet[current_row,1]= course_group.name
|
|
|
|
|
# sheet[current_row,2]= course_group.invite_code
|
|
|
|
|
# sheet[current_row,3]= course_group.members.size
|
|
|
|
|
# current_row += 1
|
|
|
|
|
# end
|
|
|
|
|
# end
|
|
|
|
|
#
|
|
|
|
|
# sheet2 = book.create_worksheet :name => "活跃度"
|
|
|
|
|
# sheet2[0,0] = "课程编号"
|
|
|
|
|
# sheet2[0,1] = course.id
|
|
|
|
|
# sheet2[1,0] = "课程名称"
|
|
|
|
|
# sheet2[1,1] = course.name
|
|
|
|
|
# sheet2[2,0] = "教师团队"
|
|
|
|
|
# sheet2[2,1] = teacher_co
|
|
|
|
|
# sheet2[3,0] = "主讲教师"
|
|
|
|
|
# sheet2[3,1] = course.teacher.show_real_name
|
|
|
|
|
# sheet2.row(4).concat(["排名","学生姓名","昵称","学号","分班","作业完成数(*10)","试卷完成数(*10)","问卷完成数(*7)","资源发布数(*5)","帖子发布数(*2)","帖子回复数(*1)","作业回复数(*1)","活跃度"])
|
|
|
|
|
# act_members = members
|
|
|
|
|
# act_members.each do |member|
|
|
|
|
|
# member[:act_score] = ((member.homework_num.to_i + member.graduation_num.to_i) * 10) + (member.exercise_num.to_i * 10) + (member.poll_num.to_i * 7) + (member.resource_num.to_i * 5) + (member.message_num.to_i * 2) + member.message_reply_num.to_i + member.homework_journal_num.to_i
|
|
|
|
|
# end
|
|
|
|
|
# act_members = act_members.sort do |a, b|
|
|
|
|
|
# [b[:act_score]] <=> [a[:act_score]]
|
|
|
|
|
# end
|
|
|
|
|
# count_row = 5
|
|
|
|
|
# act_members.each_with_index do |act_member, index|
|
|
|
|
|
# sheet2[count_row,0]= index + 1
|
|
|
|
|
# sheet2[count_row,1] = act_member.user.show_real_name
|
|
|
|
|
# sheet2[count_row,2] = act_member.user.login
|
|
|
|
|
# sheet2[count_row,3] = act_member.user.user_extensions.student_id
|
|
|
|
|
# sheet2[count_row,4] = act_member.course_group_id == 0 ? "暂无" : act_member.course_group.name
|
|
|
|
|
# sheet2[count_row,5]= act_member.homework_num.to_i + act_member.graduation_num.to_i
|
|
|
|
|
# sheet2[count_row,6]= act_member.exercise_num
|
|
|
|
|
# sheet2[count_row,7]= act_member.poll_num
|
|
|
|
|
# sheet2[count_row,8]= act_member.resource_num
|
|
|
|
|
# sheet2[count_row,9]= act_member.message_num
|
|
|
|
|
# sheet2[count_row,10]= act_member.message_reply_num
|
|
|
|
|
# sheet2[count_row,11]= act_member.homework_journal_num
|
|
|
|
|
# sheet2[count_row,12]= act_member.act_score
|
|
|
|
|
# count_row += 1
|
|
|
|
|
# end
|
|
|
|
|
|
|
|
|
|
homeworks.where(:homework_type => 4).includes(:score_student_works).each_with_index do |home, i|
|
|
|
|
|
sheet = book.create_worksheet :name => "#{home.name}"
|
|
|
|
|
sheet[0,0] = "课程编号"
|
|
|
|
|
sheet[0,1] = course.id
|
|
|
|
|
sheet[1,0] = "课程名称"
|
|
|
|
|
sheet[1,1] = course.name
|
|
|
|
|
sheet[2,0] = "教师团队"
|
|
|
|
|
sheet[2,1] = teacher_co
|
|
|
|
|
sheet[3,0] = "主讲教师"
|
|
|
|
|
sheet[3,1] = course.teacher.show_real_name
|
|
|
|
|
sheet[3,0] = "作业批次"
|
|
|
|
|
sheet[3,1] = "第#{i+1}次"
|
|
|
|
|
sheet[3,0] = "作业名称"
|
|
|
|
|
sheet[3,1] = home.name
|
|
|
|
|
sheet.row(4).concat([l(:excel_rank),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),"分班",l(:excel_homework_des),l(:excel_l_penalty),l(:excel_f_score),l(:excel_commit_time)])
|
|
|
|
|
count_row = 5
|
|
|
|
|
items = home.score_student_works
|
|
|
|
|
# if items.count == 0 && home.publish_time < Time.now && !course.is_end
|
|
|
|
|
# update_shixun_work_status home
|
|
|
|
|
# items = StudentWork.where("work_status != 0 and homework_common_id = #{home.id}").order("work_score desc")
|
|
|
|
|
# end
|
|
|
|
|
items.each_with_index do |stu, j|
|
|
|
|
|
sheet[count_row,0]= j + 1
|
|
|
|
|
sheet[count_row,1] = stu.user.show_real_name
|
|
|
|
|
sheet[count_row,2] = stu.user.login
|
|
|
|
|
sheet[count_row,3] = stu.user.user_extensions.student_id
|
|
|
|
|
sheet[count_row,4] = member_group_name course.members, stu.user_id
|
|
|
|
|
sheet[count_row,5] = strip_html stu.description
|
|
|
|
|
sheet[count_row,6] = stu.late_penalty
|
|
|
|
|
sheet[count_row,7] = stu.work_score.nil? ? l(:label_without_score) : stu.work_score.round(1)
|
|
|
|
|
sheet[count_row,8] = format_time(stu.commit_time)
|
|
|
|
|
count_row += 1
|
|
|
|
|
end
|
|
|
|
|
common_score = 0
|
|
|
|
|
homeworks.where(:homework_type => 1).includes(:score_student_works).each do |homework|
|
|
|
|
|
student_works = homework.score_student_works.select{|work| work.user_id == member.user.id}
|
|
|
|
|
if student_works.empty?
|
|
|
|
|
sheet1[count_row,column+=1] = 0
|
|
|
|
|
else
|
|
|
|
|
work_score = student_works.first.work_score.nil? ? 0 : student_works.first.work_score
|
|
|
|
|
sheet1[count_row,column+=1] = work_score < 0 ? 0 : work_score.round(1)
|
|
|
|
|
common_score += work_score < 0 ? 0 : work_score.round(1)
|
|
|
|
|
end
|
|
|
|
|
# current_col += 1
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
homeworks.where(:homework_type => 1).each_with_index do |home, i|
|
|
|
|
|
sheet = book.create_worksheet :name => "普通作业第#{i+1}次"
|
|
|
|
|
sheet[0,0] = "课程编号"
|
|
|
|
|
sheet[0,1] = course.id
|
|
|
|
|
sheet[1,0] = "课程名称"
|
|
|
|
|
sheet[1,1] = course.name
|
|
|
|
|
sheet[2,0] = "教师团队"
|
|
|
|
|
sheet[2,1] = teacher_co
|
|
|
|
|
sheet[3,0] = "主讲教师"
|
|
|
|
|
sheet[3,1] = course.teacher.show_real_name
|
|
|
|
|
sheet[3,0] = "作业批次"
|
|
|
|
|
sheet[3,1] = "第#{i+1}次"
|
|
|
|
|
sheet[3,0] = "作业名称"
|
|
|
|
|
sheet[3,1] = home.name
|
|
|
|
|
if home.anonymous_comment ==0
|
|
|
|
|
sheet.row(4).concat([l(:excel_rank),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_homework_des),
|
|
|
|
|
l(:excel_t_score),l(:excel_ta_score), l(:excel_n_score),l(:excel_a_penalty),l(:excel_l_penalty),l(:excel_f_score),l(:excel_commit_time)])
|
|
|
|
|
else
|
|
|
|
|
sheet.row(4).concat([l(:excel_rank),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_homework_des),
|
|
|
|
|
l(:excel_t_score),l(:excel_ta_score),l(:excel_l_penalty),l(:excel_f_score),l(:excel_commit_time)])
|
|
|
|
|
end
|
|
|
|
|
group_score = 0
|
|
|
|
|
homeworks.where(:homework_type => 3).includes(:score_student_works).each do |homework|
|
|
|
|
|
student_works = homework.score_student_works.select{|work| work.user_id == member.user.id}
|
|
|
|
|
if student_works.empty?
|
|
|
|
|
sheet1[count_row,column+=1] = 0
|
|
|
|
|
count_row = 5
|
|
|
|
|
items = home.score_student_works
|
|
|
|
|
items.each_with_index do |stu, j|
|
|
|
|
|
sheet[count_row,0]= j + 1
|
|
|
|
|
sheet[count_row,1] = stu.user.show_real_name
|
|
|
|
|
sheet[count_row,2] = stu.user.login
|
|
|
|
|
sheet[count_row,3] = stu.user.user_extensions.student_id
|
|
|
|
|
sheet[count_row,4] = strip_html stu.description
|
|
|
|
|
sheet[count_row,5] = stu.teacher_score.nil? ? l(:label_without_score) : stu.teacher_score.round(1)
|
|
|
|
|
sheet[count_row,6] = stu.teaching_asistant_score.nil? ? l(:label_without_score) : stu.teaching_asistant_score.round(1)
|
|
|
|
|
if home.anonymous_comment ==0
|
|
|
|
|
sheet[count_row,7] = stu.student_score.nil? ? l(:label_without_score) : stu.student_score.round(1)
|
|
|
|
|
sheet[count_row,8] = (home.teacher_priority == 1 && !stu.teacher_score.nil?) ? 0 : stu.absence_penalty
|
|
|
|
|
sheet[count_row,9] = (home.teacher_priority == 1 && !stu.teacher_score.nil?) ? 0 : stu.late_penalty
|
|
|
|
|
sheet[count_row,10] = stu.work_score.nil? ? l(:label_without_score) : stu.work_score.round(1)
|
|
|
|
|
sheet[count_row,11] = format_time(stu.commit_time)
|
|
|
|
|
else
|
|
|
|
|
work_score = student_works.first.work_score.nil? ? 0 : student_works.first.work_score
|
|
|
|
|
sheet1[count_row,column+=1] = work_score < 0 ? 0 : work_score.round(1)
|
|
|
|
|
group_score += work_score < 0 ? 0 : work_score.round(1)
|
|
|
|
|
sheet[count_row,7] = (home.teacher_priority == 1 && !stu.teacher_score.nil?) ? 0 : stu.late_penalty
|
|
|
|
|
sheet[count_row,8] = stu.work_score.nil? ? l(:label_without_score) : stu.work_score.round(1)
|
|
|
|
|
sheet[count_row,9] = format_time(stu.commit_time)
|
|
|
|
|
end
|
|
|
|
|
# current_col += 1
|
|
|
|
|
count_row += 1
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
homeworks.where(:homework_type => 3).each_with_index do |home, i|
|
|
|
|
|
sheet = book.create_worksheet :name => "分组作业第#{i+1}次"
|
|
|
|
|
sheet[0,0] = "课程编号"
|
|
|
|
|
sheet[0,1] = course.id
|
|
|
|
|
sheet[1,0] = "课程名称"
|
|
|
|
|
sheet[1,1] = course.name
|
|
|
|
|
sheet[2,0] = "教师团队"
|
|
|
|
|
sheet[2,1] = teacher_co
|
|
|
|
|
sheet[3,0] = "主讲教师"
|
|
|
|
|
sheet[3,1] = course.teacher.show_real_name
|
|
|
|
|
sheet[3,0] = "作业批次"
|
|
|
|
|
sheet[3,1] = "第#{i+1}次"
|
|
|
|
|
sheet[3,0] = "作业名称"
|
|
|
|
|
sheet[3,1] = home.name
|
|
|
|
|
|
|
|
|
|
if home.anonymous_comment ==0
|
|
|
|
|
sheet.row(4).concat([l(:excel_rank),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_group_member),l(:excel_homework_des),
|
|
|
|
|
l(:excel_t_score),l(:excel_ta_score),l(:excel_n_score),l(:excel_a_penalty),l(:excel_l_penalty),l(:excel_f_score),l(:excel_commit_time)])
|
|
|
|
|
else
|
|
|
|
|
sheet.row(4).concat([l(:excel_rank),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_group_member),l(:excel_homework_des),
|
|
|
|
|
l(:excel_t_score),l(:excel_ta_score),l(:excel_l_penalty),l(:excel_f_score),l(:excel_commit_time)])
|
|
|
|
|
end
|
|
|
|
|
exercise_score = 0
|
|
|
|
|
exercises.includes(:score_exercise_users).each do |exercise|
|
|
|
|
|
exercise_user = exercise.score_exercise_users.select{|work| work.user_id == member.user.id}
|
|
|
|
|
if exercise_user.empty?
|
|
|
|
|
sheet1[count_row,column+=1] = 0
|
|
|
|
|
count_row = 5
|
|
|
|
|
items = home.score_student_works
|
|
|
|
|
items.each_with_index do |stu, j|
|
|
|
|
|
sheet[count_row,0] = j + 1
|
|
|
|
|
sheet[count_row,1] = stu.user.show_real_name
|
|
|
|
|
sheet[count_row,2] = stu.user.login
|
|
|
|
|
sheet[count_row,3] = stu.user.user_extensions.student_id
|
|
|
|
|
sheet[count_row,4] = get_group_member_names home.student_works.where(:group_id => stu.group_id).pluck(:user_id)
|
|
|
|
|
sheet[count_row,5] = strip_html stu.description
|
|
|
|
|
sheet[count_row,6] = stu.teacher_score.nil? ? l(:label_without_score) : stu.teacher_score.round(1)
|
|
|
|
|
sheet[count_row,7] = stu.teaching_asistant_score.nil? ? l(:label_without_score) : stu.teaching_asistant_score.round(1)
|
|
|
|
|
if home.anonymous_comment ==0
|
|
|
|
|
sheet[count_row,8] = stu.student_score.nil? ? l(:label_without_score) : stu.student_score.round(1)
|
|
|
|
|
sheet[count_row,9] = (home.teacher_priority == 1 && !stu.teacher_score.nil?) ? 0 : stu.absence_penalty
|
|
|
|
|
sheet[count_row,10] = (home.teacher_priority == 1 && !stu.teacher_score.nil?) ? 0 : stu.late_penalty
|
|
|
|
|
sheet[count_row,11] = stu.work_score.nil? ? l(:label_without_score) : stu.work_score.round(1)
|
|
|
|
|
sheet[count_row,12] = format_time(stu.commit_time)
|
|
|
|
|
else
|
|
|
|
|
work_score = exercise_user.first.score.nil? ? 0 : exercise_user.first.score
|
|
|
|
|
sheet1[count_row,column+=1] = work_score < 0 ? 0 : work_score.round(1)
|
|
|
|
|
exercise_score += work_score < 0 ? 0 : work_score.round(1)
|
|
|
|
|
sheet[count_row,8] = (home.teacher_priority == 1 && !stu.teacher_score.nil?) ? 0 : stu.late_penalty
|
|
|
|
|
sheet[count_row,9] = stu.work_score.nil? ? l(:label_without_score) : stu.work_score.round(1)
|
|
|
|
|
sheet[count_row,10] = format_time(stu.commit_time)
|
|
|
|
|
end
|
|
|
|
|
# current_col += 1
|
|
|
|
|
count_row += 1
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
graduation_score = 0
|
|
|
|
|
tasks.includes(:graduation_works).each do |task|
|
|
|
|
|
graduation_works = task.graduation_works.where("user_id = #{member.user.id}")
|
|
|
|
|
if graduation_works.empty?
|
|
|
|
|
sheet1[count_row,column+=1] = 0
|
|
|
|
|
else
|
|
|
|
|
work_score = graduation_works.first.work_score.nil? ? 0 : graduation_works.first.work_score
|
|
|
|
|
sheet1[count_row,column+=1] = work_score < 0 ? 0 : work_score.round(1)
|
|
|
|
|
graduation_score += work_score < 0 ? 0 : work_score.round(1)
|
|
|
|
|
end
|
|
|
|
|
# current_col += 1
|
|
|
|
|
exercises.each_with_index do |exercise, i|
|
|
|
|
|
sheet = book.create_worksheet :name => "试卷第#{i+1}次"
|
|
|
|
|
sheet[0,0] = "课程编号"
|
|
|
|
|
sheet[0,1] = course.id
|
|
|
|
|
sheet[1,0] = "课程名称"
|
|
|
|
|
sheet[1,1] = course.name
|
|
|
|
|
sheet[3,0] = "教师团队"
|
|
|
|
|
sheet[3,1] = teacher_co
|
|
|
|
|
sheet[3,0] = "主讲教师"
|
|
|
|
|
sheet[3,1] = course.teacher.show_real_name
|
|
|
|
|
sheet[3,0] = "试卷批次"
|
|
|
|
|
sheet[3,1] = "第#{i+1}次"
|
|
|
|
|
sheet[3,0] = "试卷名称"
|
|
|
|
|
sheet[3,1] = exercise.exercise_name
|
|
|
|
|
|
|
|
|
|
sheet.row(4).concat([l(:excel_rank),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_objective_score),l(:excel_subjective_score),l(:excel_f_score),l(:excel_answer_time)])
|
|
|
|
|
count_row = 5
|
|
|
|
|
items = exercise.score_exercise_users
|
|
|
|
|
items.each_with_index do |stu, j|
|
|
|
|
|
sheet[count_row,0] = j + 1
|
|
|
|
|
sheet[count_row,1] = stu.user.show_real_name
|
|
|
|
|
sheet[count_row,2] = stu.user.login
|
|
|
|
|
sheet[count_row,3] = stu.user.user_extensions.student_id
|
|
|
|
|
sheet[count_row,4] = stu.objective_score == -1 ? "0.0" : format("%.1f",stu.objective_score)
|
|
|
|
|
sheet[count_row,5] = stu.subjective_score == -1 ? "0.0" : format("%.1f",stu.subjective_score)
|
|
|
|
|
sheet[count_row,6] = stu.score.nil? ? '--' : stu.score.round(1)
|
|
|
|
|
sheet[count_row,7] = stu.commit_status == 0 ? l(:excel_no_answer) : format_time(stu.start_at)
|
|
|
|
|
count_row += 1
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
sum = shixun_score + common_score + group_score + exercise_score + graduation_score
|
|
|
|
|
sheet1[count_row,column+=1] = shixun_score
|
|
|
|
|
sheet1[count_row,column+=1] = common_score
|
|
|
|
|
sheet1[count_row,column+=1] = group_score
|
|
|
|
|
sheet1[count_row,column+=1] = exercise_score
|
|
|
|
|
if tasks.count > 0
|
|
|
|
|
sheet1[count_row,column+=1] = graduation_score
|
|
|
|
|
tasks.each_with_index do |task, i|
|
|
|
|
|
sheet = book.create_worksheet :name => "毕设任务第#{i+1}次"
|
|
|
|
|
sheet[0,0] = "课程编号"
|
|
|
|
|
sheet[0,1] = course.id
|
|
|
|
|
sheet[1,0] = "课程名称"
|
|
|
|
|
sheet[1,1] = course.name
|
|
|
|
|
sheet[2,0] = "教师团队"
|
|
|
|
|
sheet[2,1] = teacher_co
|
|
|
|
|
sheet[3,0] = "主讲教师"
|
|
|
|
|
sheet[3,1] = course.teacher.show_real_name
|
|
|
|
|
sheet[3,0] = "作业批次"
|
|
|
|
|
sheet[3,1] = "第#{i+1}次"
|
|
|
|
|
sheet[3,0] = "作业名称"
|
|
|
|
|
sheet[3,1] = task.name
|
|
|
|
|
sheet.row(4).concat([l(:excel_rank),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id)])
|
|
|
|
|
if task.task_type == 2
|
|
|
|
|
sheet.row(4).concat([l(:excel_group_member)])
|
|
|
|
|
end
|
|
|
|
|
sheet1[count_row,column+=1] = sum.round(1)
|
|
|
|
|
count_row += 1
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
if course.course_groups.count > 0
|
|
|
|
|
sheet = book.create_worksheet :name => "分班信息"
|
|
|
|
|
sheet.row(0).concat(["课程编号", course.id])
|
|
|
|
|
sheet.row(1).concat(["课程名称", course.name])
|
|
|
|
|
sheet.row(2).concat(["教师团队", teacher_co])
|
|
|
|
|
sheet.row(3).concat(["主讲教师", course.teacher.show_real_name])
|
|
|
|
|
sheet.row(4).concat(["序号", "分班名称", "邀请码", "学生数量"])
|
|
|
|
|
current_row = 5
|
|
|
|
|
course.course_groups.includes(:members).each do |course_group|
|
|
|
|
|
sheet[current_row,0]= current_row - 4
|
|
|
|
|
sheet[current_row,1]= course_group.name
|
|
|
|
|
sheet[current_row,2]= course_group.invite_code
|
|
|
|
|
sheet[current_row,3]= course_group.members.size
|
|
|
|
|
current_row += 1
|
|
|
|
|
sheet.row(4).concat([l(:excel_homework_des), l(:excel_t_score)])
|
|
|
|
|
if task.cross_comment
|
|
|
|
|
sheet.row(4).concat(["交叉评分"])
|
|
|
|
|
end
|
|
|
|
|
sheet.row(4).concat([l(:excel_l_penalty),l(:excel_f_score),l(:excel_commit_time)])
|
|
|
|
|
count_row = 5
|
|
|
|
|
items = task.graduation_works.where("work_status != 0").order("work_score desc")
|
|
|
|
|
items.each_with_index do |stu, j|
|
|
|
|
|
column = 0
|
|
|
|
|
sheet[count_row,column]= j + 1
|
|
|
|
|
sheet[count_row,column+=1] = stu.user.show_real_name
|
|
|
|
|
sheet[count_row,column+=1] = stu.user.login
|
|
|
|
|
sheet[count_row,column+=1] = stu.user.user_extensions.student_id
|
|
|
|
|
if task.task_type == 2
|
|
|
|
|
sheet[count_row,column+=1] = get_group_member_names task.graduation_works.where(:group_id => stu.group_id).pluck(:user_id)
|
|
|
|
|
end
|
|
|
|
|
sheet[count_row,column+=1] = strip_html stu.description
|
|
|
|
|
sheet[count_row,column+=1] = stu.teacher_score.nil? ? l(:label_without_score) : stu.teacher_score.round(1)
|
|
|
|
|
if task.cross_comment
|
|
|
|
|
sheet[count_row,column+=1] = stu.cross_score.nil? ? l(:label_without_score) : stu.cross_score.round(1)
|
|
|
|
|
end
|
|
|
|
|
sheet[count_row,column+=1] = stu.late_penalty
|
|
|
|
|
sheet[count_row,column+=1] = stu.work_score.nil? ? l(:label_without_score) : stu.work_score.round(1)
|
|
|
|
|
sheet[count_row,column+=1] = format_time(stu.commit_time)
|
|
|
|
|
count_row += 1
|
|
|
|
|
end
|
|
|
|
|
=begin
|
|
|
|
|
if task.task_type == 1
|
|
|
|
|
if task.cross_comment
|
|
|
|
|
sheet.row(4).concat([l(:excel_rank),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_homework_des),
|
|
|
|
|
l(:excel_t_score),"交叉评分",l(:excel_l_penalty),l(:excel_f_score),l(:excel_commit_time)])
|
|
|
|
|
else
|
|
|
|
|
sheet.row(4).concat([l(:excel_rank),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_homework_des),
|
|
|
|
|
l(:excel_t_score),l(:excel_l_penalty),l(:excel_f_score),l(:excel_commit_time)])
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
if task.cross_comment
|
|
|
|
|
sheet.row(4).concat([l(:excel_rank),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_group_member),l(:excel_homework_des),
|
|
|
|
|
l(:excel_t_score),"交叉评分",l(:excel_l_penalty),l(:excel_f_score),l(:excel_commit_time)])
|
|
|
|
|
else
|
|
|
|
|
sheet.row(4).concat([l(:excel_rank),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_group_member),l(:excel_homework_des),
|
|
|
|
|
l(:excel_t_score),l(:excel_l_penalty),l(:excel_f_score),l(:excel_commit_time)])
|
|
|
|
|
end
|
|
|
|
|
count_row = 5
|
|
|
|
|
items = task.graduation_works.order("work_score desc")
|
|
|
|
|
items.each_with_index do |stu, j|
|
|
|
|
|
column = 0
|
|
|
|
|
sheet[count_row,column]= j + 1
|
|
|
|
|
sheet[count_row,column+1] = stu.user.show_name
|
|
|
|
|
sheet[count_row,column+1] = stu.user.login
|
|
|
|
|
sheet[count_row,column+1] = stu.user.user_extensions.student_id
|
|
|
|
|
sheet[count_row,column+1] = strip_html stu.description
|
|
|
|
|
sheet[count_row,column+1] = stu.teacher_score.nil? ? l(:label_without_score) : stu.teacher_score.round(2)
|
|
|
|
|
if task.cross_comment
|
|
|
|
|
sheet[count_row,column+1] = stu.cross_score.nil? ? l(:label_without_score) : stu.cross_score.round(2)
|
|
|
|
|
end
|
|
|
|
|
sheet[count_row,column+1] = stu.late_penalty
|
|
|
|
|
sheet[count_row,column+1] = stu.work_score.nil? ? l(:label_without_score) : stu.work_score.round(2)
|
|
|
|
|
sheet[count_row,column+1] = format_time(stu.commit_time)
|
|
|
|
|
count_row += 1
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
=end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
sheet2 = book.create_worksheet :name => "活跃度"
|
|
|
|
|
sheet2[0,0] = "课程编号"
|
|
|
|
|
sheet2[0,1] = course.id
|
|
|
|
|
sheet2[1,0] = "课程名称"
|
|
|
|
|
sheet2[1,1] = course.name
|
|
|
|
|
sheet2[2,0] = "教师团队"
|
|
|
|
|
sheet2[2,1] = teacher_co
|
|
|
|
|
sheet2[3,0] = "主讲教师"
|
|
|
|
|
sheet2[3,1] = course.teacher.show_real_name
|
|
|
|
|
sheet2.row(4).concat(["排名","学生姓名","昵称","学号","分班","作业完成数(*10)","试卷完成数(*10)","问卷完成数(*7)","资源发布数(*5)","帖子发布数(*2)","帖子回复数(*1)","作业回复数(*1)","活跃度"])
|
|
|
|
|
act_members = members
|
|
|
|
|
act_members.each do |member|
|
|
|
|
|
member[:act_score] = ((member.homework_num.to_i + member.graduation_num.to_i) * 10) + (member.exercise_num.to_i * 10) + (member.poll_num.to_i * 7) + (member.resource_num.to_i * 5) + (member.message_num.to_i * 2) + member.message_reply_num.to_i + member.homework_journal_num.to_i
|
|
|
|
|
end
|
|
|
|
|
act_members = act_members.sort do |a, b|
|
|
|
|
|
[b[:act_score]] <=> [a[:act_score]]
|
|
|
|
|
end
|
|
|
|
|
count_row = 5
|
|
|
|
|
act_members.each_with_index do |act_member, index|
|
|
|
|
|
sheet2[count_row,0]= index + 1
|
|
|
|
|
sheet2[count_row,1] = act_member.user.show_real_name
|
|
|
|
|
sheet2[count_row,2] = act_member.user.login
|
|
|
|
|
sheet2[count_row,3] = act_member.user.user_extensions.student_id
|
|
|
|
|
sheet2[count_row,4] = act_member.course_group_id == 0 ? "暂无" : act_member.course_group.name
|
|
|
|
|
sheet2[count_row,5]= act_member.homework_num.to_i + act_member.graduation_num.to_i
|
|
|
|
|
sheet2[count_row,6]= act_member.exercise_num
|
|
|
|
|
sheet2[count_row,7]= act_member.poll_num
|
|
|
|
|
sheet2[count_row,8]= act_member.resource_num
|
|
|
|
|
sheet2[count_row,9]= act_member.message_num
|
|
|
|
|
sheet2[count_row,10]= act_member.message_reply_num
|
|
|
|
|
sheet2[count_row,11]= act_member.homework_journal_num
|
|
|
|
|
sheet2[count_row,12]= act_member.act_score
|
|
|
|
|
count_row += 1
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
# homeworks.where(:homework_type => 4).each_with_index do |home, i|
|
|
|
|
|
# sheet = book.create_worksheet :name => "#{home.name}"
|
|
|
|
|
# sheet[0,0] = "课程编号"
|
|
|
|
|
# sheet[0,1] = course.id
|
|
|
|
|
# sheet[1,0] = "课程名称"
|
|
|
|
|
# sheet[1,1] = course.name
|
|
|
|
|
# sheet[2,0] = "教师团队"
|
|
|
|
|
# sheet[2,1] = teacher_co
|
|
|
|
|
# sheet[3,0] = "主讲教师"
|
|
|
|
|
# sheet[3,1] = course.teacher.show_real_name
|
|
|
|
|
# sheet[3,0] = "作业批次"
|
|
|
|
|
# sheet[3,1] = "第#{i+1}次"
|
|
|
|
|
# sheet[3,0] = "作业名称"
|
|
|
|
|
# sheet[3,1] = home.name
|
|
|
|
|
# sheet.row(4).concat([l(:excel_rank),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_homework_des),l(:excel_l_penalty),l(:excel_f_score),l(:excel_commit_time)])
|
|
|
|
|
# count_row = 5
|
|
|
|
|
# items = home.score_student_works
|
|
|
|
|
# # if items.count == 0 && home.publish_time < Time.now && !course.is_end
|
|
|
|
|
# # update_shixun_work_status home
|
|
|
|
|
# # items = StudentWork.where("work_status != 0 and homework_common_id = #{home.id}").order("work_score desc")
|
|
|
|
|
# # end
|
|
|
|
|
# items.each_with_index do |stu, j|
|
|
|
|
|
# sheet[count_row,0]= j + 1
|
|
|
|
|
# sheet[count_row,1] = stu.user.show_real_name
|
|
|
|
|
# sheet[count_row,2] = stu.user.login
|
|
|
|
|
# sheet[count_row,3] = stu.user.user_extensions.student_id
|
|
|
|
|
# sheet[count_row,4] = strip_html stu.description
|
|
|
|
|
# sheet[count_row,5] = stu.late_penalty
|
|
|
|
|
# sheet[count_row,6] = stu.work_score.nil? ? l(:label_without_score) : stu.work_score.round(1)
|
|
|
|
|
# sheet[count_row,7] = format_time(stu.commit_time)
|
|
|
|
|
# count_row += 1
|
|
|
|
|
# end
|
|
|
|
|
# end
|
|
|
|
|
#
|
|
|
|
|
# homeworks.where(:homework_type => 1).each_with_index do |home, i|
|
|
|
|
|
# sheet = book.create_worksheet :name => "普通作业第#{i+1}次"
|
|
|
|
|
# sheet[0,0] = "课程编号"
|
|
|
|
|
# sheet[0,1] = course.id
|
|
|
|
|
# sheet[1,0] = "课程名称"
|
|
|
|
|
# sheet[1,1] = course.name
|
|
|
|
|
# sheet[2,0] = "教师团队"
|
|
|
|
|
# sheet[2,1] = teacher_co
|
|
|
|
|
# sheet[3,0] = "主讲教师"
|
|
|
|
|
# sheet[3,1] = course.teacher.show_real_name
|
|
|
|
|
# sheet[3,0] = "作业批次"
|
|
|
|
|
# sheet[3,1] = "第#{i+1}次"
|
|
|
|
|
# sheet[3,0] = "作业名称"
|
|
|
|
|
# sheet[3,1] = home.name
|
|
|
|
|
# if home.anonymous_comment ==0
|
|
|
|
|
# sheet.row(4).concat([l(:excel_rank),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_homework_des),
|
|
|
|
|
# l(:excel_t_score),l(:excel_ta_score), l(:excel_n_score),l(:excel_a_penalty),l(:excel_l_penalty),l(:excel_f_score),l(:excel_commit_time)])
|
|
|
|
|
# else
|
|
|
|
|
# sheet.row(4).concat([l(:excel_rank),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_homework_des),
|
|
|
|
|
# l(:excel_t_score),l(:excel_ta_score),l(:excel_l_penalty),l(:excel_f_score),l(:excel_commit_time)])
|
|
|
|
|
# end
|
|
|
|
|
# count_row = 5
|
|
|
|
|
# items = home.score_student_works
|
|
|
|
|
# items.each_with_index do |stu, j|
|
|
|
|
|
# sheet[count_row,0]= j + 1
|
|
|
|
|
# sheet[count_row,1] = stu.user.show_real_name
|
|
|
|
|
# sheet[count_row,2] = stu.user.login
|
|
|
|
|
# sheet[count_row,3] = stu.user.user_extensions.student_id
|
|
|
|
|
# sheet[count_row,4] = strip_html stu.description
|
|
|
|
|
# sheet[count_row,5] = stu.teacher_score.nil? ? l(:label_without_score) : stu.teacher_score.round(1)
|
|
|
|
|
# sheet[count_row,6] = stu.teaching_asistant_score.nil? ? l(:label_without_score) : stu.teaching_asistant_score.round(1)
|
|
|
|
|
# if home.anonymous_comment ==0
|
|
|
|
|
# sheet[count_row,7] = stu.student_score.nil? ? l(:label_without_score) : stu.student_score.round(1)
|
|
|
|
|
# sheet[count_row,8] = (home.teacher_priority == 1 && !stu.teacher_score.nil?) ? 0 : stu.absence_penalty
|
|
|
|
|
# sheet[count_row,9] = (home.teacher_priority == 1 && !stu.teacher_score.nil?) ? 0 : stu.late_penalty
|
|
|
|
|
# sheet[count_row,10] = stu.work_score.nil? ? l(:label_without_score) : stu.work_score.round(1)
|
|
|
|
|
# sheet[count_row,11] = format_time(stu.commit_time)
|
|
|
|
|
# else
|
|
|
|
|
# sheet[count_row,7] = (home.teacher_priority == 1 && !stu.teacher_score.nil?) ? 0 : stu.late_penalty
|
|
|
|
|
# sheet[count_row,8] = stu.work_score.nil? ? l(:label_without_score) : stu.work_score.round(1)
|
|
|
|
|
# sheet[count_row,9] = format_time(stu.commit_time)
|
|
|
|
|
# end
|
|
|
|
|
# count_row += 1
|
|
|
|
|
# end
|
|
|
|
|
#
|
|
|
|
|
# end
|
|
|
|
|
#
|
|
|
|
|
# homeworks.where(:homework_type => 3).each_with_index do |home, i|
|
|
|
|
|
# sheet = book.create_worksheet :name => "分组作业第#{i+1}次"
|
|
|
|
|
# sheet[0,0] = "课程编号"
|
|
|
|
|
# sheet[0,1] = course.id
|
|
|
|
|
# sheet[1,0] = "课程名称"
|
|
|
|
|
# sheet[1,1] = course.name
|
|
|
|
|
# sheet[2,0] = "教师团队"
|
|
|
|
|
# sheet[2,1] = teacher_co
|
|
|
|
|
# sheet[3,0] = "主讲教师"
|
|
|
|
|
# sheet[3,1] = course.teacher.show_real_name
|
|
|
|
|
# sheet[3,0] = "作业批次"
|
|
|
|
|
# sheet[3,1] = "第#{i+1}次"
|
|
|
|
|
# sheet[3,0] = "作业名称"
|
|
|
|
|
# sheet[3,1] = home.name
|
|
|
|
|
#
|
|
|
|
|
# if home.anonymous_comment ==0
|
|
|
|
|
# sheet.row(4).concat([l(:excel_rank),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_group_member),l(:excel_homework_des),
|
|
|
|
|
# l(:excel_t_score),l(:excel_ta_score),l(:excel_n_score),l(:excel_a_penalty),l(:excel_l_penalty),l(:excel_f_score),l(:excel_commit_time)])
|
|
|
|
|
# else
|
|
|
|
|
# sheet.row(4).concat([l(:excel_rank),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_group_member),l(:excel_homework_des),
|
|
|
|
|
# l(:excel_t_score),l(:excel_ta_score),l(:excel_l_penalty),l(:excel_f_score),l(:excel_commit_time)])
|
|
|
|
|
# end
|
|
|
|
|
# count_row = 5
|
|
|
|
|
# items = home.score_student_works
|
|
|
|
|
# items.each_with_index do |stu, j|
|
|
|
|
|
# sheet[count_row,0] = j + 1
|
|
|
|
|
# sheet[count_row,1] = stu.user.show_real_name
|
|
|
|
|
# sheet[count_row,2] = stu.user.login
|
|
|
|
|
# sheet[count_row,3] = stu.user.user_extensions.student_id
|
|
|
|
|
# sheet[count_row,4] = get_group_member_names home.student_works.where(:group_id => stu.group_id).pluck(:user_id)
|
|
|
|
|
# sheet[count_row,5] = strip_html stu.description
|
|
|
|
|
# sheet[count_row,6] = stu.teacher_score.nil? ? l(:label_without_score) : stu.teacher_score.round(1)
|
|
|
|
|
# sheet[count_row,7] = stu.teaching_asistant_score.nil? ? l(:label_without_score) : stu.teaching_asistant_score.round(1)
|
|
|
|
|
# if home.anonymous_comment ==0
|
|
|
|
|
# sheet[count_row,8] = stu.student_score.nil? ? l(:label_without_score) : stu.student_score.round(1)
|
|
|
|
|
# sheet[count_row,9] = (home.teacher_priority == 1 && !stu.teacher_score.nil?) ? 0 : stu.absence_penalty
|
|
|
|
|
# sheet[count_row,10] = (home.teacher_priority == 1 && !stu.teacher_score.nil?) ? 0 : stu.late_penalty
|
|
|
|
|
# sheet[count_row,11] = stu.work_score.nil? ? l(:label_without_score) : stu.work_score.round(1)
|
|
|
|
|
# sheet[count_row,12] = format_time(stu.commit_time)
|
|
|
|
|
# else
|
|
|
|
|
# sheet[count_row,8] = (home.teacher_priority == 1 && !stu.teacher_score.nil?) ? 0 : stu.late_penalty
|
|
|
|
|
# sheet[count_row,9] = stu.work_score.nil? ? l(:label_without_score) : stu.work_score.round(1)
|
|
|
|
|
# sheet[count_row,10] = format_time(stu.commit_time)
|
|
|
|
|
# end
|
|
|
|
|
# count_row += 1
|
|
|
|
|
# end
|
|
|
|
|
# end
|
|
|
|
|
#
|
|
|
|
|
# exercises.each_with_index do |exercise, i|
|
|
|
|
|
# sheet = book.create_worksheet :name => "试卷第#{i+1}次"
|
|
|
|
|
# sheet[0,0] = "课程编号"
|
|
|
|
|
# sheet[0,1] = course.id
|
|
|
|
|
# sheet[1,0] = "课程名称"
|
|
|
|
|
# sheet[1,1] = course.name
|
|
|
|
|
# sheet[3,0] = "教师团队"
|
|
|
|
|
# sheet[3,1] = teacher_co
|
|
|
|
|
# sheet[3,0] = "主讲教师"
|
|
|
|
|
# sheet[3,1] = course.teacher.show_real_name
|
|
|
|
|
# sheet[3,0] = "试卷批次"
|
|
|
|
|
# sheet[3,1] = "第#{i+1}次"
|
|
|
|
|
# sheet[3,0] = "试卷名称"
|
|
|
|
|
# sheet[3,1] = exercise.exercise_name
|
|
|
|
|
#
|
|
|
|
|
# sheet.row(4).concat([l(:excel_rank),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_objective_score),l(:excel_subjective_score),l(:excel_f_score),l(:excel_answer_time)])
|
|
|
|
|
# count_row = 5
|
|
|
|
|
# items = exercise.score_exercise_users
|
|
|
|
|
# items.each_with_index do |stu, j|
|
|
|
|
|
# sheet[count_row,0] = j + 1
|
|
|
|
|
# sheet[count_row,1] = stu.user.show_real_name
|
|
|
|
|
# sheet[count_row,2] = stu.user.login
|
|
|
|
|
# sheet[count_row,3] = stu.user.user_extensions.student_id
|
|
|
|
|
# sheet[count_row,4] = stu.objective_score == -1 ? "0.0" : format("%.1f",stu.objective_score)
|
|
|
|
|
# sheet[count_row,5] = stu.subjective_score == -1 ? "0.0" : format("%.1f",stu.subjective_score)
|
|
|
|
|
# sheet[count_row,6] = stu.score.nil? ? '--' : stu.score.round(1)
|
|
|
|
|
# sheet[count_row,7] = stu.commit_status == 0 ? l(:excel_no_answer) : format_time(stu.start_at)
|
|
|
|
|
# count_row += 1
|
|
|
|
|
# end
|
|
|
|
|
# end
|
|
|
|
|
#
|
|
|
|
|
# tasks.each_with_index do |task, i|
|
|
|
|
|
# sheet = book.create_worksheet :name => "毕设任务第#{i+1}次"
|
|
|
|
|
# sheet[0,0] = "课程编号"
|
|
|
|
|
# sheet[0,1] = course.id
|
|
|
|
|
# sheet[1,0] = "课程名称"
|
|
|
|
|
# sheet[1,1] = course.name
|
|
|
|
|
# sheet[2,0] = "教师团队"
|
|
|
|
|
# sheet[2,1] = teacher_co
|
|
|
|
|
# sheet[3,0] = "主讲教师"
|
|
|
|
|
# sheet[3,1] = course.teacher.show_real_name
|
|
|
|
|
# sheet[3,0] = "作业批次"
|
|
|
|
|
# sheet[3,1] = "第#{i+1}次"
|
|
|
|
|
# sheet[3,0] = "作业名称"
|
|
|
|
|
# sheet[3,1] = task.name
|
|
|
|
|
# sheet.row(4).concat([l(:excel_rank),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id)])
|
|
|
|
|
# if task.task_type == 2
|
|
|
|
|
# sheet.row(4).concat([l(:excel_group_member)])
|
|
|
|
|
# end
|
|
|
|
|
# sheet.row(4).concat([l(:excel_homework_des), l(:excel_t_score)])
|
|
|
|
|
# if task.cross_comment
|
|
|
|
|
# sheet.row(4).concat(["交叉评分"])
|
|
|
|
|
# end
|
|
|
|
|
# sheet.row(4).concat([l(:excel_l_penalty),l(:excel_f_score),l(:excel_commit_time)])
|
|
|
|
|
# count_row = 5
|
|
|
|
|
# items = task.graduation_works.where("work_status != 0").order("work_score desc")
|
|
|
|
|
# items.each_with_index do |stu, j|
|
|
|
|
|
# column = 0
|
|
|
|
|
# sheet[count_row,column]= j + 1
|
|
|
|
|
# sheet[count_row,column+=1] = stu.user.show_real_name
|
|
|
|
|
# sheet[count_row,column+=1] = stu.user.login
|
|
|
|
|
# sheet[count_row,column+=1] = stu.user.user_extensions.student_id
|
|
|
|
|
# if task.task_type == 2
|
|
|
|
|
# sheet[count_row,column+=1] = get_group_member_names task.graduation_works.where(:group_id => stu.group_id).pluck(:user_id)
|
|
|
|
|
# end
|
|
|
|
|
# sheet[count_row,column+=1] = strip_html stu.description
|
|
|
|
|
# sheet[count_row,column+=1] = stu.teacher_score.nil? ? l(:label_without_score) : stu.teacher_score.round(1)
|
|
|
|
|
# if task.cross_comment
|
|
|
|
|
# sheet[count_row,column+=1] = stu.cross_score.nil? ? l(:label_without_score) : stu.cross_score.round(1)
|
|
|
|
|
# end
|
|
|
|
|
# sheet[count_row,column+=1] = stu.late_penalty
|
|
|
|
|
# sheet[count_row,column+=1] = stu.work_score.nil? ? l(:label_without_score) : stu.work_score.round(1)
|
|
|
|
|
# sheet[count_row,column+=1] = format_time(stu.commit_time)
|
|
|
|
|
# count_row += 1
|
|
|
|
|
# end
|
|
|
|
|
# =begin
|
|
|
|
|
# if task.task_type == 1
|
|
|
|
|
# if task.cross_comment
|
|
|
|
|
# sheet.row(4).concat([l(:excel_rank),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_homework_des),
|
|
|
|
|
# l(:excel_t_score),"交叉评分",l(:excel_l_penalty),l(:excel_f_score),l(:excel_commit_time)])
|
|
|
|
|
# else
|
|
|
|
|
# sheet.row(4).concat([l(:excel_rank),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_homework_des),
|
|
|
|
|
# l(:excel_t_score),l(:excel_l_penalty),l(:excel_f_score),l(:excel_commit_time)])
|
|
|
|
|
# end
|
|
|
|
|
# else
|
|
|
|
|
# if task.cross_comment
|
|
|
|
|
# sheet.row(4).concat([l(:excel_rank),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_group_member),l(:excel_homework_des),
|
|
|
|
|
# l(:excel_t_score),"交叉评分",l(:excel_l_penalty),l(:excel_f_score),l(:excel_commit_time)])
|
|
|
|
|
# else
|
|
|
|
|
# sheet.row(4).concat([l(:excel_rank),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_group_member),l(:excel_homework_des),
|
|
|
|
|
# l(:excel_t_score),l(:excel_l_penalty),l(:excel_f_score),l(:excel_commit_time)])
|
|
|
|
|
# end
|
|
|
|
|
# count_row = 5
|
|
|
|
|
# items = task.graduation_works.order("work_score desc")
|
|
|
|
|
# items.each_with_index do |stu, j|
|
|
|
|
|
# column = 0
|
|
|
|
|
# sheet[count_row,column]= j + 1
|
|
|
|
|
# sheet[count_row,column+1] = stu.user.show_name
|
|
|
|
|
# sheet[count_row,column+1] = stu.user.login
|
|
|
|
|
# sheet[count_row,column+1] = stu.user.user_extensions.student_id
|
|
|
|
|
# sheet[count_row,column+1] = strip_html stu.description
|
|
|
|
|
# sheet[count_row,column+1] = stu.teacher_score.nil? ? l(:label_without_score) : stu.teacher_score.round(2)
|
|
|
|
|
# if task.cross_comment
|
|
|
|
|
# sheet[count_row,column+1] = stu.cross_score.nil? ? l(:label_without_score) : stu.cross_score.round(2)
|
|
|
|
|
# end
|
|
|
|
|
# sheet[count_row,column+1] = stu.late_penalty
|
|
|
|
|
# sheet[count_row,column+1] = stu.work_score.nil? ? l(:label_without_score) : stu.work_score.round(2)
|
|
|
|
|
# sheet[count_row,column+1] = format_time(stu.commit_time)
|
|
|
|
|
# count_row += 1
|
|
|
|
|
# end
|
|
|
|
|
# end
|
|
|
|
|
# =end
|
|
|
|
|
# end
|
|
|
|
|
|
|
|
|
|
book.write xls_report
|
|
|
|
|
xls_report.string
|
|
|
|
|
end
|
|
|
|
|