|
|
|
@ -1176,7 +1176,7 @@ class CoursesController < ApplicationController
|
|
|
|
|
|
|
|
|
|
def export_course_member_excel
|
|
|
|
|
q = params[:name] ? "#{params[:name].strip}" : ""
|
|
|
|
|
filename="#{@course.teacher.show_real_name.to_s }_#{@course.name}_#{l(:excel_member_list)}";
|
|
|
|
|
filename="#{@course.teacher.show_real_name.to_s }_#{@course.name}_#{l(:excel_member_list)}"
|
|
|
|
|
if params[:group_id] && params[:group_id] != "0" && params[:group_id] != "-1"
|
|
|
|
|
group = CourseGroup.find params[:group_id]
|
|
|
|
|
unless group.nil?
|
|
|
|
@ -2437,48 +2437,48 @@ 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}")
|
|
|
|
|
if student_works.empty?
|
|
|
|
|
homeworks.where(:homework_type => 4).each do |homework|
|
|
|
|
|
student_works = homework.score_student_works.find_by_user_id(member.user.id)
|
|
|
|
|
if student_works.nil?
|
|
|
|
|
sheet1[count_row,column+=1] = 0
|
|
|
|
|
else
|
|
|
|
|
work_score = student_works.first.work_score.nil? ? 0 : student_works.first.work_score
|
|
|
|
|
work_score = student_works.work_score.nil? ? 0 : student_works.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(:student_works).each do |homework|
|
|
|
|
|
student_works = homework.student_works.where("user_id = #{member.user.id}")
|
|
|
|
|
if student_works.empty?
|
|
|
|
|
homeworks.where(:homework_type => 1).each do |homework|
|
|
|
|
|
student_works = homework.score_student_works.find_by_user_id(member.user.id)
|
|
|
|
|
if student_works.nil?
|
|
|
|
|
sheet1[count_row,column+=1] = 0
|
|
|
|
|
else
|
|
|
|
|
work_score = student_works.first.work_score.nil? ? 0 : student_works.first.work_score
|
|
|
|
|
work_score = student_works.work_score.nil? ? 0 : student_works.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(:student_works).each do |homework|
|
|
|
|
|
student_works = homework.student_works.where("user_id = #{member.user.id}")
|
|
|
|
|
if student_works.empty?
|
|
|
|
|
homeworks.where(:homework_type => 3).each do |homework|
|
|
|
|
|
student_works = homework.score_student_works.find_by_user_id(member.user.id)
|
|
|
|
|
if student_works.nil?
|
|
|
|
|
sheet1[count_row,column+=1] = 0
|
|
|
|
|
else
|
|
|
|
|
work_score = student_works.first.work_score.nil? ? 0 : student_works.first.work_score
|
|
|
|
|
work_score = student_works.work_score.nil? ? 0 : student_works.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(:exercise_users).each do |exercise|
|
|
|
|
|
exercise_user = exercise.exercise_users.where("user_id = #{member.user.id}")
|
|
|
|
|
if exercise_user.empty?
|
|
|
|
|
exercises.each do |exercise|
|
|
|
|
|
exercise_user = exercise.score_exercise_users.find_by_user_id(member.user.id)
|
|
|
|
|
if exercise_user.nil?
|
|
|
|
|
sheet1[count_row,column+=1] = 0
|
|
|
|
|
else
|
|
|
|
|
work_score = exercise_user.first.score.nil? ? 0 : exercise_user.first.score
|
|
|
|
|
work_score = exercise_user.score.nil? ? 0 : exercise_user.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
|
|
|
|
@ -2486,7 +2486,7 @@ class CoursesController < ApplicationController
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
graduation_score = 0
|
|
|
|
|
tasks.includes(:graduation_works).each do |task|
|
|
|
|
|
tasks.each do |task|
|
|
|
|
|
graduation_works = task.graduation_works.where("user_id = #{member.user.id}")
|
|
|
|
|
if graduation_works.empty?
|
|
|
|
|
sheet1[count_row,column+=1] = 0
|
|
|
|
@ -2576,7 +2576,7 @@ class CoursesController < ApplicationController
|
|
|
|
|
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)])
|
|
|
|
|
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
|
|
|
|
@ -2588,10 +2588,11 @@ class CoursesController < ApplicationController
|
|
|
|
|
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)
|
|
|
|
|
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
|
|
|
|
|
end
|
|
|
|
|