diff --git a/app/services/exercise_user_pdf_service.rb b/app/services/exercise_user_pdf_service.rb index d74e66d31..6dbb11c83 100644 --- a/app/services/exercise_user_pdf_service.rb +++ b/app/services/exercise_user_pdf_service.rb @@ -42,6 +42,7 @@ class ExerciseUserPdfService # aa.syswrite(kit.source) #正式需删掉------- file = Tempfile.new(filename) + logger.info("###########__________________file.path_______________########################{file.path}") kit.to_pdf(file.path) file end diff --git a/app/templates/exercise_export/exercise_user.html.erb b/app/templates/exercise_export/exercise_user.html.erb index d769ca0f0..70c023d26 100644 --- a/app/templates/exercise_export/exercise_user.html.erb +++ b/app/templates/exercise_export/exercise_user.html.erb @@ -1 +1,353 @@ -11111111111111 \ No newline at end of file + + +
+ + + + ++ <%= @exercise.try(:exercise_description).nil? ? "" : @exercise.try(:exercise_description)&.html_safe %> +
++ <% if @exercise_single_ques_count > 0 %> + 单选题<%= @exercise_single_ques_count %>题, + 共<%= @exercise_single_ques_scores %>分 + <% end %> + <% if @exercise_double_ques_count > 0 %> + 多选题<%= @exercise_double_ques_count %>题, + 共<%= @exercise_double_ques_scores %>分 + <% end %> + <% if @exercise_ques_judge_count > 0 %> + 判断题<%= @exercise_ques_judge_count %>题, + 共<%= @exercise_ques_judge_scores %>分 + <% end %> + <% if @exercise_ques_null_count > 0 %> + 填空题<%= @exercise_ques_null_count %>题, + 共<%= @exercise_ques_null_scores %>分 + <% end %> + <% if @exercise_ques_main_count > 0 %> + 主观题<%= @exercise_ques_main_count %>题, + 共<%= @exercise_ques_main_scores %>分 + <% end %> + <% if @exercise_ques_shixun_count > 0 %> + 实训题<%= @exercise_ques_shixun_count %>题, + 共<%= @exercise_ques_shixun_scores %>分 + <% end %> + + <% if @exercise_ques_count > 0 %> + + 共<%= @exercise_ques_scores %>分 + + + 合计<%= @exercise_ques_count %>题 + + <% end %> +
++ 客观题 + 正确 + 错误 + 部分得分 + 总分:<%= @exercise_user&.score %>分 +
++ 主观题 + 已评 + 未评 + 开始答题时间:<%= @exercise_user.start_at.present? ? @exercise_user.start_at.strftime("%Y-%m-%d %H:%M") : "--" %> +
++ + <%= convert_to_char((index+1).to_s)%><%= s.choice_text%> +
+ <% end %> + <% elsif q_type == 1 %> + <% q.exercise_choices.each_with_index do |s,index| %> + <% check_answer = (user_answer.present? && (user_answer.pluck(:exercise_choice_id).include?(s.id))) ? true : false %> ++ <% if check_answer %> + + <% else %> + + <% end %> + <%= convert_to_char((index+1).to_s)%><%= s.choice_text%> +
+ <% end %> + <% elsif q_type == 2 %> ++ <% q.exercise_choices.each do |s| %> + <% if user_answer.present? && (s.id == user_answer.first.exercise_choice_id) %> + <% check_answer = 'choose-answer' %> + <% else %> + <% check_answer = '' %> + <% end %> + + + <%= s.choice_text %> + + <% end %> +
+ <% elsif q_type == 3 %> + <% st_counts = q.exercise_standard_answers.pluck(:exercise_choice_id).uniq %> + <% st_counts.each_with_index do |s,index| %> + <% if user_answer.present? && user_answer.where(exercise_choice_id:s).present? %> + <% check_answer = user_answer.where(exercise_choice_id:s).first.answer_text %> + <% else %> + <% check_answer = "--" %> + <% end %> ++ 答案(填空<%= index+1 %>): + <%= check_answer&.html_safe %> +
+ <% end %> + <% elsif q_type == 4 %> + <% check_answer = (user_answer.present? ? user_answer.first.answer_text : '--') %> ++ <%= check_answer&.html_safe %> +
+ <% else %> ++ 阶段成绩 +
+关卡 | +任务名称 | +评测次数 | +完成时间 | +耗时 | +经验值 | +得分/满分 | + + + <% if @games.size > 0 %> + <% @games.each_with_index do |game, index| %> + <% user_score = q.exercise_shixun_answers.where(exercise_shixun_challenge_id:game.challenge.id,user_id: @ex_user_user.id) %> + <% game_score = q.exercise_shixun_challenges.where(challenge_id:game.challenge.id) %> +
---|---|---|---|---|---|---|
<%= index + 1 %> | ++ <%= game.challenge.subject %> + | +<%= game.evaluate_count %> | +<%= game.end_time.present? ? game.end_time.strftime("%Y-%m-%d %H:%M") : "--" %> | +<%= ApplicationController.helpers.time_consuming game %> | +<%= game.final_score %> / <%= game.challenge.all_score %> | +<%= user_score.present? ? user_score.first.score : 0.0 %> / <%= game_score.present? ? game_score.first.question_score : 0.0 %> | +
<%= index + 1 %> | ++ <%= game.challenge.subject %> + | +0 | +-- | +-- | +0.0 / <%= game.challenge.all_score %> | +0.0 / <%= game_score.present? ? game_score.first.question_score : 0.0 %> | +
+ 实训详情 +
+ <% @games.each_with_index do |game, index| %> ++ 第<%= index+1 %>关<%= game.challenge.subject %> +
+评测次数 | +评测信息 | + + + <% outputs = game.outputs.group("query_index") %> + <% outputs.reverse.try(:each) do |output| %> +
---|---|
<%= "第#{output.query_index}次" %> | +<%= output_detail(game, output) %> | +
+ + 最近通过的代码 + <%= game.challenge.path %> + +
+<%= ques_user.real_name %><%= ques_comment.first.updated_at.strftime('%Y-%m-%d %H:%M') %>
+<%= ques_comment.first.comment %>
+