|
|
|
@ -22,21 +22,21 @@ module ExportHelper
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
shixun_homeworks = shixun_homeworks&.includes(:score_student_works)
|
|
|
|
|
shixun_homeworks = shixun_homeworks&.includes(:student_works)
|
|
|
|
|
|
|
|
|
|
common_homeworks = homeworks.search_homework_type(1) #全部普通作业
|
|
|
|
|
common_titles = common_homeworks.pluck(:name)+ ["总得分"]
|
|
|
|
|
common_homeworks = common_homeworks&.includes(:score_student_works)
|
|
|
|
|
common_homeworks = common_homeworks&.includes(:student_works)
|
|
|
|
|
|
|
|
|
|
group_homeworks = homeworks.search_homework_type(3) #全部分组作业
|
|
|
|
|
group_titles = group_homeworks.pluck(:name)+ ["总得分"]
|
|
|
|
|
group_homeworks = group_homeworks&.includes(:score_student_works)
|
|
|
|
|
group_homeworks = group_homeworks&.includes(:student_works)
|
|
|
|
|
|
|
|
|
|
task_titles = tasks.pluck(:name) + ["总得分"]
|
|
|
|
|
tasks = tasks&.includes(:score_graduation_works)
|
|
|
|
|
tasks = tasks&.includes(:graduation_works)
|
|
|
|
|
|
|
|
|
|
exercise_titles = exercises.pluck(:exercise_name) + ["总得分"]
|
|
|
|
|
exercises = exercises&.includes(:score_exercise_users)
|
|
|
|
|
exercises = exercises&.includes(:exercise_users)
|
|
|
|
|
|
|
|
|
|
total_user_score_array = [] #学生总成绩集合
|
|
|
|
|
|
|
|
|
@ -67,7 +67,7 @@ module ExportHelper
|
|
|
|
|
#实训作业
|
|
|
|
|
if shixun_homeworks.size > 0
|
|
|
|
|
shixun_homeworks.each do |s|
|
|
|
|
|
user_student_work = s.score_student_works.select{|work| work.user_id == user.id}.first #当前用户的对该作业的回答
|
|
|
|
|
user_student_work = s.student_works.select{|work| work.user_id == user.id}.first #当前用户的对该作业的回答
|
|
|
|
|
if user_student_work.nil?
|
|
|
|
|
h_score = 0.0 #该作业的得分为0
|
|
|
|
|
else
|
|
|
|
@ -82,7 +82,7 @@ module ExportHelper
|
|
|
|
|
#普通作业
|
|
|
|
|
if common_homeworks.size > 0
|
|
|
|
|
common_homeworks.each do |c|
|
|
|
|
|
user_student_work_1 = c.score_student_works.select{|work| work.user_id == user.id}.first #当前用户的对该作业的回答
|
|
|
|
|
user_student_work_1 = c.student_works.select{|work| work.user_id == user.id}.first #当前用户的对该作业的回答
|
|
|
|
|
if user_student_work_1.nil?
|
|
|
|
|
h_score_1 = 0.0 #该作业的得分为0
|
|
|
|
|
else
|
|
|
|
@ -97,7 +97,7 @@ module ExportHelper
|
|
|
|
|
#分组作业
|
|
|
|
|
if group_homeworks.size > 0
|
|
|
|
|
group_homeworks.each do |g|
|
|
|
|
|
user_student_work_3 = g.score_student_works.select{|work| work.user_id == user.id}.first #当前用户的对该作业的回答
|
|
|
|
|
user_student_work_3 = g.student_works.select{|work| work.user_id == user.id}.first #当前用户的对该作业的回答
|
|
|
|
|
if user_student_work_3.nil?
|
|
|
|
|
h_score_3 = 0.0 #该作业的得分为0
|
|
|
|
|
else
|
|
|
|
@ -112,7 +112,7 @@ module ExportHelper
|
|
|
|
|
#毕设作业
|
|
|
|
|
if tasks.size > 0
|
|
|
|
|
tasks.each do |task|
|
|
|
|
|
graduation_work = task.score_graduation_works.select{|work| work.user_id == user.id}.first
|
|
|
|
|
graduation_work = task.graduation_works.select{|work| work.user_id == user.id}.first
|
|
|
|
|
if graduation_work.nil?
|
|
|
|
|
t_score = 0.0
|
|
|
|
|
else
|
|
|
|
@ -127,7 +127,7 @@ module ExportHelper
|
|
|
|
|
#试卷
|
|
|
|
|
if exercises.size > 0
|
|
|
|
|
exercises.each do |ex|
|
|
|
|
|
exercise_work = ex.score_exercise_users.select{|work| work.user_id == user.id}.first
|
|
|
|
|
exercise_work = ex.exercise_users.select{|work| work.user_id == user.id}.first
|
|
|
|
|
if exercise_work.nil?
|
|
|
|
|
e_score = 0.0
|
|
|
|
|
else
|
|
|
|
@ -168,7 +168,7 @@ module ExportHelper
|
|
|
|
|
|
|
|
|
|
#实训作业
|
|
|
|
|
shixun_homeworks.each_with_index do |s,index|
|
|
|
|
|
all_student_works = s.score_student_works.where(user_id: all_user_ids) #该实训题的全部用户回答
|
|
|
|
|
all_student_works = s.student_works.where(user_id: all_user_ids) #该实训题的全部用户回答
|
|
|
|
|
title_no = index.to_i + 1
|
|
|
|
|
student_work_to_xlsx(all_student_works,s)
|
|
|
|
|
shixun_work_display_name = format_sheet_name (title_no.to_s + "." + s.name).strip.first(30)
|
|
|
|
@ -178,7 +178,7 @@ module ExportHelper
|
|
|
|
|
|
|
|
|
|
#普通作业
|
|
|
|
|
common_homeworks.each_with_index do |c,index|
|
|
|
|
|
all_student_works = c.score_student_works.where(user_id: all_user_ids) #当前用户的对该作业的回答
|
|
|
|
|
all_student_works = c.student_works.where(user_id: all_user_ids) #当前用户的对该作业的回答
|
|
|
|
|
title_no = count_1 + index.to_i + 1
|
|
|
|
|
student_work_to_xlsx(all_student_works,c)
|
|
|
|
|
|
|
|
|
@ -190,7 +190,7 @@ module ExportHelper
|
|
|
|
|
|
|
|
|
|
#分组作业
|
|
|
|
|
group_homeworks.each_with_index do |c,index|
|
|
|
|
|
all_student_works = c.score_student_works.where(user_id: all_user_ids) #当前用户的对该作业的回答
|
|
|
|
|
all_student_works = c.student_works.where(user_id: all_user_ids) #当前用户的对该作业的回答
|
|
|
|
|
title_no = count_1 + count_2 + index.to_i + 1
|
|
|
|
|
student_work_to_xlsx(all_student_works,c)
|
|
|
|
|
work_name = format_sheet_name (title_no.to_s + "." + c.name).strip.first(30)
|
|
|
|
@ -200,7 +200,7 @@ module ExportHelper
|
|
|
|
|
|
|
|
|
|
#毕设任务
|
|
|
|
|
tasks.each_with_index do |c,index|
|
|
|
|
|
all_student_works = c.score_graduation_works.where(user_id: all_user_ids) #当前用户的对该作业的回答
|
|
|
|
|
all_student_works = c.graduation_works.where(user_id: all_user_ids) #当前用户的对该作业的回答
|
|
|
|
|
title_no = count_1 + count_2 + count_3 + index.to_i + 1
|
|
|
|
|
graduation_work_to_xlsx(all_student_works,c,current_user)
|
|
|
|
|
work_name = format_sheet_name (title_no.to_s + "." + c.name).strip.first(30)
|
|
|
|
@ -210,7 +210,7 @@ module ExportHelper
|
|
|
|
|
|
|
|
|
|
#试卷的导出
|
|
|
|
|
exercises.each_with_index do |c,index|
|
|
|
|
|
all_student_works = c.score_exercise_users.where(user_id: all_user_ids) #当前用户的对该作业的回答
|
|
|
|
|
all_student_works = c.exercise_users.where(user_id: all_user_ids) #当前用户的对该作业的回答
|
|
|
|
|
title_no = count_1 + count_2 + count_3 + count_4 + index.to_i + 1
|
|
|
|
|
get_export_users(c,course,all_student_works)
|
|
|
|
|
work_name = format_sheet_name (title_no.to_s + "." + c.exercise_name).strip.first(30)
|
|
|
|
@ -429,7 +429,7 @@ module ExportHelper
|
|
|
|
|
end
|
|
|
|
|
else #实训题
|
|
|
|
|
shixun = homework.shixuns.take
|
|
|
|
|
shixun_head_cells = %w(完成情况 通关时间 学员在EduCoder做实训花费的时间 总评测次数 获得经验值 关卡得分)
|
|
|
|
|
shixun_head_cells = %w(截止前完成关卡 通关时间 学员在EduCoder做实训花费的时间 总评测次数 获得经验值 关卡得分)
|
|
|
|
|
eff_boolean = homework.work_efficiency
|
|
|
|
|
if eff_boolean
|
|
|
|
|
eff_score_cell = ["效率分"]
|
|
|
|
@ -466,7 +466,7 @@ module ExportHelper
|
|
|
|
|
else
|
|
|
|
|
w_6 = "--"
|
|
|
|
|
end
|
|
|
|
|
w_7 = w.work_status == 0 ? '--' : myshixun.try(:passed_count).to_s+"/"+shixun.challenges_count.to_s
|
|
|
|
|
w_7 = w.work_status == 0 ? '--' : myshixun&.time_passed_count(homework.homework_group_setting(w.user_id)&.end_time).to_i.to_s+"/"+shixun.challenges_count.to_s
|
|
|
|
|
w_8 = myshixun ? myshixun.try(:passed_time).to_s == "--" ? "--" : format_time(myshixun.try(:passed_time)) : "--" # 通关时间
|
|
|
|
|
w_9 = myshixun ? (myshixun.try(:passed_count).to_i > 0 ? myshixun.total_spend_time : '--') : "--" #总耗时
|
|
|
|
|
w_10 = myshixun ? myshixun.output_times : 0 #评测次数
|
|
|
|
|