|
|
|
@ -282,14 +282,19 @@ class StudentWorkController < ApplicationController
|
|
|
|
|
respond_to do |format|
|
|
|
|
|
format.xls {
|
|
|
|
|
send_data(absence_penalty_list_xls(@stundet_works), :type => "text/excel;charset=utf-8; header=present",
|
|
|
|
|
:filename => "#{@course.teacher.lastname.to_s + @course.teacher.firstname}_#{@course.name}_#{@course.time.to_s + @course.term}_#{@homework.name}#{l(:excel_homework_list)}.xls")
|
|
|
|
|
:filename => "#{@course.teacher.lastname.to_s + @course.teacher.firstname}_#{@course.name}_#{@course.time.to_s + @course.term}_#{@homework.name}#{l(:excel_absence_list)}.xls")
|
|
|
|
|
}
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
#导出匿评列表
|
|
|
|
|
def evaluation_list
|
|
|
|
|
|
|
|
|
|
respond_to do |format|
|
|
|
|
|
format.xls {
|
|
|
|
|
send_data(evaluation_list_xls(@homework.student_works), :type => "text/excel;charset=utf-8; header=present",
|
|
|
|
|
:filename => "#{@course.teacher.lastname.to_s + @course.teacher.firstname}_#{@course.name}_#{@course.time.to_s + @course.term}_#{@homework.name}#{l(:excel_evaluation_list)}.xls")
|
|
|
|
|
}
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
private
|
|
|
|
@ -373,15 +378,43 @@ class StudentWorkController < ApplicationController
|
|
|
|
|
sheet1.row(0).concat([l(:excel_student_id),l(:excel_nickname),l(:excel_user_name),l(:lable_all_penalty),l(:lable_has_penalty),l(:lable_absence_penalty)])
|
|
|
|
|
count_row = 1
|
|
|
|
|
items.each do |homework|
|
|
|
|
|
sheet1[count_row,0]=homework.user.user_extensions.student_id
|
|
|
|
|
sheet1[count_row,1]=homework.user.login
|
|
|
|
|
sheet1[count_row,2]=homework.user.lastname.to_s + homework.user.firstname.to_s
|
|
|
|
|
sheet1[count_row,3]=homework.all_count
|
|
|
|
|
sheet1[count_row,4]=homework.has_count
|
|
|
|
|
sheet1[count_row,5]=homework.absence
|
|
|
|
|
sheet1[count_row,0] = homework.user.user_extensions.student_id
|
|
|
|
|
sheet1[count_row,1] = homework.user.login
|
|
|
|
|
sheet1[count_row,2] = homework.user.lastname.to_s + homework.user.firstname.to_s
|
|
|
|
|
sheet1[count_row,3] = homework.all_count
|
|
|
|
|
sheet1[count_row,4] = homework.has_count
|
|
|
|
|
sheet1[count_row,5] = homework.absence
|
|
|
|
|
count_row += 1
|
|
|
|
|
end
|
|
|
|
|
book.write xls_report
|
|
|
|
|
xls_report.string
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
#匿评列表转换为excel
|
|
|
|
|
def evaluation_list_xls items
|
|
|
|
|
xls_report = StringIO.new
|
|
|
|
|
book = Spreadsheet::Workbook.new
|
|
|
|
|
sheet1 = book.create_worksheet :name => "homework"
|
|
|
|
|
blue = Spreadsheet::Format.new :color => :blue, :weight => :bold, :size => 10
|
|
|
|
|
sheet1.row(0).default_format = blue
|
|
|
|
|
|
|
|
|
|
sheet1.row(0).concat([l(:label_work_name),l(:label_work_id),l(:label_work_autor),l(:label_evaluation_id),l(:label_evaluation_name),
|
|
|
|
|
l(:label_evaluation_score),l(:label_evaluation_common),l(:label_evaluation_time)])
|
|
|
|
|
count_row = 1
|
|
|
|
|
items.each do |homework|
|
|
|
|
|
homework.student_works_scores.where(:reviewer_role => 3).each do |score|
|
|
|
|
|
sheet1[count_row,0] = homework.name
|
|
|
|
|
sheet1[count_row,1] = homework.user.user_extensions.student_id
|
|
|
|
|
sheet1[count_row,2] = homework.user.show_name
|
|
|
|
|
sheet1[count_row,3] = score.user.user_extensions.student_id
|
|
|
|
|
sheet1[count_row,4] = score.user.show_name
|
|
|
|
|
sheet1[count_row,5] = score.score
|
|
|
|
|
sheet1[count_row,6] = score.comment
|
|
|
|
|
sheet1[count_row,7] = format_time(score.created_at)
|
|
|
|
|
count_row += 1
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
book.write xls_report
|
|
|
|
|
xls_report.string
|
|
|
|
|
end
|
|
|
|
|
end
|