diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index a850d16c..a35860f2 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -2404,17 +2404,17 @@ class CoursesController < ApplicationController 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+"次" + homeworks.where(:homework_type => 1).each do |homework| + sheet1[4,current_col+=1] = "#{homework.name}" end - for i in 0 ... homeworks.where(:homework_type => 3).size - sheet1[4,current_col+=1] = "分组作业第"+(i+1).to_s+"次" + homeworks.where(:homework_type => 3).each do |homework| + sheet1[4,current_col+=1] = "#{homework.name}" end - for i in 0 ... exercises.size - sheet1[4,current_col+=1] = "试卷第"+(i+1).to_s+"次" + exercises.each do |exercise| + sheet1[4,current_col+=1] = "#{exercise.exercise_name}" end - for i in 0 ... tasks.size - sheet1[4,current_col+=1] = "毕设任务第"+(i+1).to_s+"次" + tasks.each do |task| + sheet1[4,current_col+=1] = "#{task.name}" end sheet1[4,current_col+=1] = "实训作业总得分" @@ -2598,7 +2598,7 @@ class CoursesController < ApplicationController end homeworks.where(:homework_type => 1).includes(:score_student_works).each_with_index do |home, i| - sheet = book.create_worksheet :name => "普通作业第#{i+1}次" + sheet = book.create_worksheet :name => "#{home.name}" sheet[0,0] = "课程编号" sheet[0,1] = course.id sheet[1,0] = "课程名称" @@ -2645,7 +2645,7 @@ class CoursesController < ApplicationController end homeworks.where(:homework_type => 3).includes(:score_student_works).each_with_index do |home, i| - sheet = book.create_worksheet :name => "分组作业第#{i+1}次" + sheet = book.create_worksheet :name => "#{home.name}" sheet[0,0] = "课程编号" sheet[0,1] = course.id sheet[1,0] = "课程名称" @@ -2693,7 +2693,7 @@ class CoursesController < ApplicationController end exercises.includes(:score_exercise_users).each_with_index do |exercise, i| - sheet = book.create_worksheet :name => "试卷第#{i+1}次" + sheet = book.create_worksheet :name => "#{exercise.exercise_name}" sheet[0,0] = "课程编号" sheet[0,1] = course.id sheet[1,0] = "课程名称" @@ -2724,7 +2724,7 @@ class CoursesController < ApplicationController end tasks.each_with_index do |task, i| - sheet = book.create_worksheet :name => "毕设任务第#{i+1}次" + sheet = book.create_worksheet :name => "#{task.name}" sheet[0,0] = "课程编号" sheet[0,1] = course.id sheet[1,0] = "课程名称"