|
|
|
@ -2437,8 +2437,8 @@ class CoursesController < ApplicationController
|
|
|
|
|
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(:student_works).each do |homework|
|
|
|
|
|
student_works = homework.student_works.where("user_id = #{member.user.id}")
|
|
|
|
|
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
|
|
|
|
@ -2449,8 +2449,8 @@ class CoursesController < ApplicationController
|
|
|
|
|
# current_col += 1
|
|
|
|
|
end
|
|
|
|
|
common_score = 0
|
|
|
|
|
homeworks.where(:homework_type => 1).includes(:student_works).each do |homework|
|
|
|
|
|
student_works = homework.student_works.where("user_id = #{member.user.id}")
|
|
|
|
|
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
|
|
|
|
@ -2461,8 +2461,8 @@ class CoursesController < ApplicationController
|
|
|
|
|
# current_col += 1
|
|
|
|
|
end
|
|
|
|
|
group_score = 0
|
|
|
|
|
homeworks.where(:homework_type => 3).includes(:student_works).each do |homework|
|
|
|
|
|
student_works = homework.student_works.where("user_id = #{member.user.id}")
|
|
|
|
|
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
|
|
|
|
@ -2473,8 +2473,8 @@ class CoursesController < ApplicationController
|
|
|
|
|
# current_col += 1
|
|
|
|
|
end
|
|
|
|
|
exercise_score = 0
|
|
|
|
|
exercises.includes(:exercise_users).each do |exercise|
|
|
|
|
|
exercise_user = exercise.exercise_users.where("user_id = #{member.user.id}")
|
|
|
|
|
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
|
|
|
|
@ -2562,7 +2562,7 @@ class CoursesController < ApplicationController
|
|
|
|
|
count_row += 1
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
homeworks.where(:homework_type => 4).includes(:score_student_works).each_with_index do |home, i|
|
|
|
|
|
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
|
|
|
|
@ -2596,7 +2596,7 @@ class CoursesController < ApplicationController
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
homeworks.where(:homework_type => 1).includes(:score_student_works).each_with_index do |home, i|
|
|
|
|
|
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
|
|
|
|
@ -2643,7 +2643,7 @@ class CoursesController < ApplicationController
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
homeworks.where(:homework_type => 3).includes(:score_student_works).each_with_index do |home, i|
|
|
|
|
|
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
|
|
|
|
@ -2691,7 +2691,7 @@ class CoursesController < ApplicationController
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
exercises.includes(:score_exercise_users).each_with_index do |exercise, i|
|
|
|
|
|
exercises.each_with_index do |exercise, i|
|
|
|
|
|
sheet = book.create_worksheet :name => "试卷第#{i+1}次"
|
|
|
|
|
sheet[0,0] = "课程编号"
|
|
|
|
|
sheet[0,1] = course.id
|
|
|
|
|