|
|
|
@ -286,10 +286,18 @@ module ExportHelper
|
|
|
|
|
@user_columns = []
|
|
|
|
|
ques_type_boolean = question_types.include?(4)
|
|
|
|
|
if ques_type_boolean #仅存在主观题或客观题的时候
|
|
|
|
|
@table_columns = @table_columns + %w(客观题成绩 主观题成绩 最终成绩 开始答题时间 提交时间)
|
|
|
|
|
@table_columns = @table_columns + %w(客观题成绩 主观题成绩 最终成绩)
|
|
|
|
|
else
|
|
|
|
|
@table_columns = @table_columns + %w(最终成绩 开始答题时间 提交时间)
|
|
|
|
|
@table_columns = @table_columns + %w(最终成绩)
|
|
|
|
|
end
|
|
|
|
|
for i in 1 .. exercise.exercise_questions.size
|
|
|
|
|
@table_columns = @table_columns + ["第#{i}题"]
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
@table_columns = @table_columns + %w(开始答题时间 提交时间)
|
|
|
|
|
|
|
|
|
|
questions = exercise.exercise_questions.includes(:exercise_answers,:exercise_shixun_answers).order("question_number ASC")
|
|
|
|
|
|
|
|
|
|
export_ex_users.includes(user: :user_extension).each_with_index do |e_user,index|
|
|
|
|
|
user_info = e_user.user
|
|
|
|
|
member = course.students.find_by_user_id(e_user.user_id)
|
|
|
|
@ -312,11 +320,36 @@ module ExportHelper
|
|
|
|
|
user_option = [index+1,user_login,user_real_name, user_mail,
|
|
|
|
|
user_student_id,user_course,user_commit_stu]
|
|
|
|
|
if ques_type_boolean
|
|
|
|
|
other_user_option = [user_obj_score,user_suj_score,user_score,user_start_time,user_end_time]
|
|
|
|
|
other_user_option = [user_obj_score,user_suj_score,user_score]
|
|
|
|
|
else
|
|
|
|
|
other_user_option = [user_score,user_start_time,user_end_time]
|
|
|
|
|
other_user_option = [user_score]
|
|
|
|
|
end
|
|
|
|
|
user_option = user_option + other_user_option
|
|
|
|
|
|
|
|
|
|
time_option = [user_start_time,user_end_time]
|
|
|
|
|
|
|
|
|
|
score_option = []
|
|
|
|
|
questions.each do |q|
|
|
|
|
|
q_type = q.question_type
|
|
|
|
|
if q_type == Exercise::PRACTICAL
|
|
|
|
|
answers_content = q.exercise_shixun_answers.select{|answer| answer.user_id == e_user.user_id}
|
|
|
|
|
else
|
|
|
|
|
answers_content = q.exercise_answers.select{|answer| answer.user_id == e_user.user_id}
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
if q_type <= Exercise::JUDGMENT || q_type == Exercise::SUBJECTIVE
|
|
|
|
|
if answers_content.present? #学生有回答时,分数已经全部存到exercise_answer 表,所以可以直接取第一个值
|
|
|
|
|
ques_score = answers_content.first.score
|
|
|
|
|
ques_score = ques_score.nil? || ques_score < 0 ? 0.0 : ques_score
|
|
|
|
|
else
|
|
|
|
|
ques_score = 0.0
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
ques_score = answers_content.score_reviewed.select(:score).pluck(:score).sum
|
|
|
|
|
end
|
|
|
|
|
score_option.push(ques_score)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
user_option = user_option + other_user_option + score_option + time_option
|
|
|
|
|
@user_columns.push(user_option)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|