From 19617532734469ddd05feb48e1b152c8a350a818 Mon Sep 17 00:00:00 2001 From: SylorHuang Date: Sat, 22 Jun 2019 14:37:01 +0800 Subject: [PATCH] fix bug --- app/helpers/export_helper.rb | 2 +- .../exercise_export/blank_exercise.html.erb | 10 +++++----- .../exercise_export/exercise_export.css | 3 +++ .../exercise_export/exercise_user.html.erb | 16 ++++++++-------- 4 files changed, 17 insertions(+), 14 deletions(-) diff --git a/app/helpers/export_helper.rb b/app/helpers/export_helper.rb index a5e3c5d9d..918995bef 100644 --- a/app/helpers/export_helper.rb +++ b/app/helpers/export_helper.rb @@ -245,7 +245,7 @@ module ExportHelper else user_course = "--" end - user_obj_score = e_user.objective_score < 0.0 ? 0.0 : e_user.subjective_score.round(1).to_s + user_obj_score = e_user.objective_score < 0.0 ? 0.0 : e_user.objective_score.round(1).to_s user_suj_score = e_user.subjective_score < 0.0 ? 0.0 : e_user.subjective_score.round(1).to_s user_score = e_user.score.present? ? e_user.score.round(1).to_s : 0.0 if e_user.commit_status.present? && e_user.commit_status == 1 diff --git a/app/templates/exercise_export/blank_exercise.html.erb b/app/templates/exercise_export/blank_exercise.html.erb index 61bde0d27..123e114b1 100644 --- a/app/templates/exercise_export/blank_exercise.html.erb +++ b/app/templates/exercise_export/blank_exercise.html.erb @@ -13,13 +13,13 @@

- <%= @exercise.try(:exercise_description).nil? ? "" : @exercise.try(:exercise_description).html_safe %> + <%= @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 %> @@ -63,12 +63,12 @@
<% if q.question_type == 5 %> - <%= q.shixun_name.present? ? q.shixun_name.html_safe : "" %> + <%= q.shixun_name.present? ? q.shixun_name&.html_safe : "" %>
- <%= q.question_title.present? ? q.question_title.html_safe : "" %> + <%= q.question_title.present? ? q.question_title&.html_safe : "" %>
<% else %> - <%= q.question_title.present? ? q.question_title.html_safe : "" %> + <%= q.question_title.present? ? q.question_title&.html_safe : "" %> <% end %>
diff --git a/app/templates/exercise_export/exercise_export.css b/app/templates/exercise_export/exercise_export.css index 91f25e45e..4747e9eed 100644 --- a/app/templates/exercise_export/exercise_export.css +++ b/app/templates/exercise_export/exercise_export.css @@ -303,6 +303,9 @@ textarea{ background-color:#eee; line-height:2; } +.max-100{ + max-width:100%; +} diff --git a/app/templates/exercise_export/exercise_user.html.erb b/app/templates/exercise_export/exercise_user.html.erb index 713f09ee4..67aaf493a 100644 --- a/app/templates/exercise_export/exercise_user.html.erb +++ b/app/templates/exercise_export/exercise_user.html.erb @@ -13,13 +13,13 @@

- <%= @exercise.try(:exercise_description).nil? ? "" : @exercise.try(:exercise_description).html_safe %> + <%= @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 %> @@ -162,14 +162,14 @@
<% if q_type == 5 %> - <%= q.shixun_name.html_safe %> + <%= q.shixun_name&.html_safe %>
- <%= q.question_title.html_safe %> + <%= q.question_title&.html_safe %>
<% elsif q_type == 4 %> - <%= q.question_title.html_safe %> + <%= q.question_title&.html_safe %> <% else %> - <%= q.question_title.html_safe %> + <%= q.question_title&.html_safe %> <% end %>
@@ -218,13 +218,13 @@ <% end %>

答案(填空<%= index+1 %>): - <%= check_answer.html_safe %> + <%= check_answer&.html_safe %>

<% end %> <% elsif q_type == 4 %> <% check_answer = (user_answer.present? ? user_answer.first.answer_text : '--') %>

- <%= check_answer.html_safe %> + <%= check_answer&.html_safe %>

<% else %>