@ -22,21 +22,21 @@ module ExportHelper
end
end
end
end
shixun_homeworks = shixun_homeworks & . includes ( :s core_s tudent_works)
shixun_homeworks = shixun_homeworks & . includes ( :s tudent_works)
common_homeworks = homeworks . search_homework_type ( 1 ) #全部普通作业
common_homeworks = homeworks . search_homework_type ( 1 ) #全部普通作业
common_titles = common_homeworks . pluck ( :name ) + [ " 总得分 " ]
common_titles = common_homeworks . pluck ( :name ) + [ " 总得分 " ]
common_homeworks = common_homeworks & . includes ( :s core_s tudent_works)
common_homeworks = common_homeworks & . includes ( :s tudent_works)
group_homeworks = homeworks . search_homework_type ( 3 ) #全部分组作业
group_homeworks = homeworks . search_homework_type ( 3 ) #全部分组作业
group_titles = group_homeworks . pluck ( :name ) + [ " 总得分 " ]
group_titles = group_homeworks . pluck ( :name ) + [ " 总得分 " ]
group_homeworks = group_homeworks & . includes ( :s core_s tudent_works)
group_homeworks = group_homeworks & . includes ( :s tudent_works)
task_titles = tasks . pluck ( :name ) + [ " 总得分 " ]
task_titles = tasks . pluck ( :name ) + [ " 总得分 " ]
tasks = tasks & . includes ( : score_ graduation_works)
tasks = tasks & . includes ( : graduation_works)
exercise_titles = exercises . pluck ( :exercise_name ) + [ " 总得分 " ]
exercise_titles = exercises . pluck ( :exercise_name ) + [ " 总得分 " ]
exercises = exercises & . includes ( : score_ exercise_users)
exercises = exercises & . includes ( : exercise_users)
total_user_score_array = [ ] #学生总成绩集合
total_user_score_array = [ ] #学生总成绩集合
@ -67,7 +67,7 @@ module ExportHelper
#实训作业
#实训作业
if shixun_homeworks . size > 0
if shixun_homeworks . size > 0
shixun_homeworks . each do | s |
shixun_homeworks . each do | s |
user_student_work = s . s core_s tudent_works. select { | work | work . user_id == user . id } . first #当前用户的对该作业的回答
user_student_work = s . s tudent_works. select { | work | work . user_id == user . id } . first #当前用户的对该作业的回答
if user_student_work . nil?
if user_student_work . nil?
h_score = 0 . 0 #该作业的得分为0
h_score = 0 . 0 #该作业的得分为0
else
else
@ -82,7 +82,7 @@ module ExportHelper
#普通作业
#普通作业
if common_homeworks . size > 0
if common_homeworks . size > 0
common_homeworks . each do | c |
common_homeworks . each do | c |
user_student_work_1 = c . s core_s tudent_works. select { | work | work . user_id == user . id } . first #当前用户的对该作业的回答
user_student_work_1 = c . s tudent_works. select { | work | work . user_id == user . id } . first #当前用户的对该作业的回答
if user_student_work_1 . nil?
if user_student_work_1 . nil?
h_score_1 = 0 . 0 #该作业的得分为0
h_score_1 = 0 . 0 #该作业的得分为0
else
else
@ -97,7 +97,7 @@ module ExportHelper
#分组作业
#分组作业
if group_homeworks . size > 0
if group_homeworks . size > 0
group_homeworks . each do | g |
group_homeworks . each do | g |
user_student_work_3 = g . s core_s tudent_works. select { | work | work . user_id == user . id } . first #当前用户的对该作业的回答
user_student_work_3 = g . s tudent_works. select { | work | work . user_id == user . id } . first #当前用户的对该作业的回答
if user_student_work_3 . nil?
if user_student_work_3 . nil?
h_score_3 = 0 . 0 #该作业的得分为0
h_score_3 = 0 . 0 #该作业的得分为0
else
else
@ -112,7 +112,7 @@ module ExportHelper
#毕设作业
#毕设作业
if tasks . size > 0
if tasks . size > 0
tasks . each do | task |
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?
if graduation_work . nil?
t_score = 0 . 0
t_score = 0 . 0
else
else
@ -127,7 +127,7 @@ module ExportHelper
#试卷
#试卷
if exercises . size > 0
if exercises . size > 0
exercises . each do | ex |
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?
if exercise_work . nil?
e_score = 0 . 0
e_score = 0 . 0
else
else
@ -168,7 +168,7 @@ module ExportHelper
#实训作业
#实训作业
shixun_homeworks . each_with_index do | s , index |
shixun_homeworks . each_with_index do | s , index |
all_student_works = s . s core_s tudent_works. where ( user_id : all_user_ids ) #该实训题的全部用户回答
all_student_works = s . s tudent_works. where ( user_id : all_user_ids ) #该实训题的全部用户回答
title_no = index . to_i + 1
title_no = index . to_i + 1
student_work_to_xlsx ( all_student_works , s )
student_work_to_xlsx ( all_student_works , s )
shixun_work_display_name = format_sheet_name ( title_no . to_s + " . " + s . name ) . strip . first ( 30 )
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 |
common_homeworks . each_with_index do | c , index |
all_student_works = c . s core_s tudent_works. where ( user_id : all_user_ids ) #当前用户的对该作业的回答
all_student_works = c . s tudent_works. where ( user_id : all_user_ids ) #当前用户的对该作业的回答
title_no = count_1 + index . to_i + 1
title_no = count_1 + index . to_i + 1
student_work_to_xlsx ( all_student_works , c )
student_work_to_xlsx ( all_student_works , c )
@ -190,7 +190,7 @@ module ExportHelper
#分组作业
#分组作业
group_homeworks . each_with_index do | c , index |
group_homeworks . each_with_index do | c , index |
all_student_works = c . s core_s tudent_works. where ( user_id : all_user_ids ) #当前用户的对该作业的回答
all_student_works = c . s tudent_works. where ( user_id : all_user_ids ) #当前用户的对该作业的回答
title_no = count_1 + count_2 + index . to_i + 1
title_no = count_1 + count_2 + index . to_i + 1
student_work_to_xlsx ( all_student_works , c )
student_work_to_xlsx ( all_student_works , c )
work_name = format_sheet_name ( title_no . to_s + " . " + c . name ) . strip . first ( 30 )
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 |
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
title_no = count_1 + count_2 + count_3 + index . to_i + 1
graduation_work_to_xlsx ( all_student_works , c , current_user )
graduation_work_to_xlsx ( all_student_works , c , current_user )
work_name = format_sheet_name ( title_no . to_s + " . " + c . name ) . strip . first ( 30 )
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 |
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
title_no = count_1 + count_2 + count_3 + count_4 + index . to_i + 1
get_export_users ( c , course , all_student_works )
get_export_users ( c , course , all_student_works )
work_name = format_sheet_name ( title_no . to_s + " . " + c . exercise_name ) . strip . first ( 30 )
work_name = format_sheet_name ( title_no . to_s + " . " + c . exercise_name ) . strip . first ( 30 )
@ -429,7 +429,7 @@ module ExportHelper
end
end
else #实训题
else #实训题
shixun = homework . shixuns . take
shixun = homework . shixuns . take
shixun_head_cells = %w( 完成情况 通关时间 学员在EduCoder做实训花费的时间 总评测次数 获得经验值 关卡得分)
shixun_head_cells = %w( 截止前完成关卡 通关时间 学员在EduCoder做实训花费的时间 总评测次数 获得经验值 关卡得分)
eff_boolean = homework . work_efficiency
eff_boolean = homework . work_efficiency
if eff_boolean
if eff_boolean
eff_score_cell = [ " 效率分 " ]
eff_score_cell = [ " 效率分 " ]
@ -455,16 +455,18 @@ module ExportHelper
course_name = course . students . find_by ( user_id : w . user_id ) . try ( :course_group_name )
course_name = course . students . find_by ( user_id : w . user_id ) . try ( :course_group_name )
w_5 = course_name . present? ? course_name : " -- "
w_5 = course_name . present? ? course_name : " -- "
#0: 未提交, 1 按时提交, 2 延迟提交
#0: 未提交, 1 按时提交, 2 延迟提交
if w . work_status == 0
if w . compelete_status == 0
w_6 = " 未提交 "
w_6 = " 未开启 "
elsif w . work_status == 1
elsif w . compelete_status == 1
w_6 = " 按时提交 "
w_6 = " 未通关 "
elsif w . work_status == 2
elsif w . compelete_status == 2
w_6 = " 延迟提交 "
w_6 = " 按时通关 "
elsif w . compelete_status == 3
w_6 = " 迟交通关 "
else
else
w_6 = " -- "
w_6 = " -- "
end
end
w_7 = w. work_status == 0 ? '--' : myshixun . try ( :passed_count ) . to_s + " / " + shixun . challenges_count . to_s
w_7 = 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_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_9 = myshixun ? ( myshixun . try ( :passed_count ) . to_i > 0 ? myshixun . total_spend_time : '--' ) : " -- " #总耗时
w_10 = myshixun ? myshixun . output_times : 0 #评测次数
w_10 = myshixun ? myshixun . output_times : 0 #评测次数