<%= @exercise.try(:exercise_name) %>

<%= @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_questions.each_with_index do |q,index| %>
<%= q.question_number %>、 <%= q.question_type_name %> (<%= q&.question_score %>分)
<% q_title = q.question_title&.include?("src=\"") ? q.question_title&.gsub("src=\"","src=\"#{@request_url}")&.html_safe : q.question_title&.html_safe %> <% if q.question_type == 5 %> <% q_name = q.shixun_name&.include?("src=\"") ? q.shixun_name&.gsub("src=\"","src=\"#{@request_url}")&.html_safe : q.shixun_name&.html_safe %> <%= q_name %>
<%= q_title %>
<% else %> <%= q_title %> <% end %>
<% if q.question_type == 0 %> <% q.exercise_choices.each_with_index do |s,index| %>

<%= convert_to_char((index+1).to_s)%><%= s.choice_text%>

<% end %> <% elsif q.question_type == 1 %> <% q.exercise_choices.each_with_index do |s,index| %>

<%= convert_to_char((index+1).to_s)%><%= s.choice_text%>

<% end %> <% elsif q.question_type == 2 %>

<% q.exercise_choices.each_with_index do |s,index| %> <%= s.choice_text %> <% end %>

<% elsif q.question_type == 3 %> <% st_counts = q.exercise_standard_answers.pluck(:exercise_choice_id).uniq %> <% st_counts.each_with_index do |s,index| %>

答案(填空<%= index+1 %>):

<% end %> <% elsif q.question_type == 4 %>

<% else %> <% q.exercise_shixun_challenges.each_with_index do |c,index| %>

第<%= index+1 %>关 <%= c.challenge.subject %> <%= c&.question_score %> 分

<% end %> <% end %>
<% end %>
<%= ApplicationController.helpers.pdf_load_sources(*%w(react/public/js/jquery-1.8.3.min.js react/public/js/editormd/marked.min.js))%>