|
|
|
@ -1139,21 +1139,21 @@ class CoursesController < ApplicationController
|
|
|
|
|
#课堂的作业信息
|
|
|
|
|
shixun_homeworks = homeworks.search_homework_type(4) #全部实训作业
|
|
|
|
|
shixun_titles = shixun_homeworks.pluck(:name) + ["总得分"]
|
|
|
|
|
shixun_homeworks = shixun_homeworks.includes(:score_student_works)
|
|
|
|
|
shixun_homeworks = shixun_homeworks&.includes(score_student_works: :user)
|
|
|
|
|
|
|
|
|
|
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(score_student_works: :user)
|
|
|
|
|
|
|
|
|
|
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(score_student_works: :user)
|
|
|
|
|
|
|
|
|
|
task_titles = tasks.pluck(:name) + ["总得分"]
|
|
|
|
|
tasks = tasks.includes(:score_graduation_works)
|
|
|
|
|
tasks = tasks&.includes(user: :user_extension, score_graduation_works: :user)
|
|
|
|
|
|
|
|
|
|
exercise_titles = exercises.pluck(:exercise_name) + ["总得分"]
|
|
|
|
|
exercises = exercises.includes(:score_exercise_users)
|
|
|
|
|
exercises = exercises&.includes(user: :user_extension, score_exercise_users: :user)
|
|
|
|
|
|
|
|
|
|
total_user_score_array = [] #学生总成绩集合
|
|
|
|
|
|
|
|
|
@ -1268,7 +1268,7 @@ class CoursesController < ApplicationController
|
|
|
|
|
|
|
|
|
|
#实训作业
|
|
|
|
|
if shixun_homeworks.size > 0
|
|
|
|
|
shixun_homeworks&.includes(:score_student_works).each do |s|
|
|
|
|
|
shixun_homeworks.each do |s|
|
|
|
|
|
user_student_work = s.score_student_works.select{|work| work.user_id == user.id}.first #当前用户的对该作业的回答
|
|
|
|
|
if user_student_work.nil?
|
|
|
|
|
h_score = 0.0 #该作业的得分为0
|
|
|
|
@ -1284,7 +1284,7 @@ class CoursesController < ApplicationController
|
|
|
|
|
|
|
|
|
|
#普通作业
|
|
|
|
|
if common_homeworks.size > 0
|
|
|
|
|
common_homeworks&.includes(:score_student_works).each do |c|
|
|
|
|
|
common_homeworks.each do |c|
|
|
|
|
|
user_student_work_1 = c.score_student_works.select{|work| work.user_id == user.id}.first #当前用户的对该作业的回答
|
|
|
|
|
if user_student_work_1.nil?
|
|
|
|
|
h_score_1 = 0.0 #该作业的得分为0
|
|
|
|
@ -1300,7 +1300,7 @@ class CoursesController < ApplicationController
|
|
|
|
|
|
|
|
|
|
#分组作业
|
|
|
|
|
if group_homeworks.size > 0
|
|
|
|
|
group_homeworks&.includes(:score_student_works).each do |g|
|
|
|
|
|
group_homeworks.each do |g|
|
|
|
|
|
user_student_work_3 = g.score_student_works.select{|work| work.user_id == user.id}.first #当前用户的对该作业的回答
|
|
|
|
|
if user_student_work_3.nil?
|
|
|
|
|
h_score_3 = 0.0 #该作业的得分为0
|
|
|
|
@ -1316,7 +1316,7 @@ class CoursesController < ApplicationController
|
|
|
|
|
|
|
|
|
|
#毕设作业
|
|
|
|
|
if tasks.size > 0
|
|
|
|
|
tasks&.includes(:score_graduation_works).each do |task|
|
|
|
|
|
tasks.each do |task|
|
|
|
|
|
graduation_work = task.score_graduation_works.select{|work| work.user_id == user.id}.first
|
|
|
|
|
if graduation_work.nil?
|
|
|
|
|
t_score = 0.0
|
|
|
|
@ -1332,7 +1332,7 @@ class CoursesController < ApplicationController
|
|
|
|
|
|
|
|
|
|
#试卷
|
|
|
|
|
if exercises.size > 0
|
|
|
|
|
exercises&.includes(:score_exercise_users).each do |ex|
|
|
|
|
|
exercises.each do |ex|
|
|
|
|
|
exercise_work = ex.score_exercise_users.select{|work| work.user_id == user.id}.first
|
|
|
|
|
if exercise_work.nil?
|
|
|
|
|
e_score = 0.0
|
|
|
|
@ -1375,7 +1375,7 @@ class CoursesController < ApplicationController
|
|
|
|
|
count_4 = tasks.size
|
|
|
|
|
count_5 = exercises.size
|
|
|
|
|
#实训作业
|
|
|
|
|
shixun_homeworks&.includes(:score_student_works).each_with_index do |s,index|
|
|
|
|
|
shixun_homeworks.each_with_index do |s,index|
|
|
|
|
|
all_student_works = s.score_student_works #该实训题的全部用户回答
|
|
|
|
|
title_no = index.to_i + 1
|
|
|
|
|
student_work_to_xlsx(all_student_works,s)
|
|
|
|
@ -1385,7 +1385,7 @@ class CoursesController < ApplicationController
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
#普通作业
|
|
|
|
|
common_homeworks&.includes(:score_student_works).each_with_index do |c,index|
|
|
|
|
|
common_homeworks.each_with_index do |c,index|
|
|
|
|
|
all_student_works = c.score_student_works #当前用户的对该作业的回答
|
|
|
|
|
title_no = count_1 + index.to_i + 1
|
|
|
|
|
student_work_to_xlsx(all_student_works,c)
|
|
|
|
@ -1397,7 +1397,7 @@ class CoursesController < ApplicationController
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
#分组作业
|
|
|
|
|
group_homeworks&.includes(:score_student_works).each_with_index do |c,index|
|
|
|
|
|
group_homeworks.each_with_index do |c,index|
|
|
|
|
|
all_student_works = c.score_student_works #当前用户的对该作业的回答
|
|
|
|
|
title_no = count_1 + count_2 + index.to_i + 1
|
|
|
|
|
student_work_to_xlsx(all_student_works,c)
|
|
|
|
@ -1407,7 +1407,7 @@ class CoursesController < ApplicationController
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
#毕设任务
|
|
|
|
|
tasks&.includes(:score_graduation_works).each_with_index do |c,index|
|
|
|
|
|
tasks.each_with_index do |c,index|
|
|
|
|
|
all_student_works = c.score_graduation_works #当前用户的对该作业的回答
|
|
|
|
|
title_no = count_1 + count_2 + count_3 + index.to_i + 1
|
|
|
|
|
graduation_work_to_xlsx(all_student_works,c,current_user)
|
|
|
|
@ -1417,7 +1417,7 @@ class CoursesController < ApplicationController
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
#试卷的导出
|
|
|
|
|
exercises&.includes(:score_exercise_users).each_with_index do |c,index|
|
|
|
|
|
exercises.each_with_index do |c,index|
|
|
|
|
|
all_student_works = c.score_exercise_users #当前用户的对该作业的回答
|
|
|
|
|
title_no = count_1 + count_2 + count_3 + count_4 + index.to_i + 1
|
|
|
|
|
get_export_users(c,course,all_student_works)
|
|
|
|
|