<% if q.question_type == 0 %>
- <% q.exercise_choices.each_with_index do |s,index| %>
-
-
- <%= convert_to_char((index+1).to_s)%><%= s.choice_text%>
-
+ <% q.exercise_choices.each do |s| %>
+
+
+ <%= to_markdown(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%>
-
+ <% q.exercise_choices.each do |s| %>
+
+
+ <%= to_markdown(s.choice_text) %>
+
<% end %>
<% elsif q.question_type == 2 %>
-
- <% q.exercise_choices.each_with_index do |s,index| %>
-
-
- <%= s.choice_text %>
+
+ <% q.exercise_choices.each do |s| %>
+
+
+ <%= 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| %>
diff --git a/app/templates/exercise_export/exercise_export.css b/app/templates/exercise_export/exercise_export.css
index 9190e9251..f0eeb0f4c 100644
--- a/app/templates/exercise_export/exercise_export.css
+++ b/app/templates/exercise_export/exercise_export.css
@@ -44,6 +44,9 @@ p{
.mbt10{
margin: 10px 0;
}
+.mt5{
+ margin-top:5px;
+}
.pull-right{
float:right;
}
@@ -82,9 +85,15 @@ p{
.ml20{
margin-left:20px;
}
+.ml10{
+ margin-left:10px;
+}
.mr3{
margin-right:3px;
}
+.mr8{
+ margin-right:8px;
+}
.mr15{
margin-right:15px;
}
@@ -248,7 +257,7 @@ table{
text-align:center;
}
-table, tr, td, th, tbody, thead, tfoot,textarea{
+table, tr, td, th, tbody, thead, tfoot,textarea,.main-choice{
page-break-inside: avoid;
}
table th{
@@ -310,5 +319,10 @@ textarea{
zoom:1;
}
+.choice-text p{
+ margin-bottom:0;
+}
+
+
diff --git a/app/templates/exercise_export/exercise_user.html.erb b/app/templates/exercise_export/exercise_user.html.erb
index 5770c5921..f523246a0 100644
--- a/app/templates/exercise_export/exercise_user.html.erb
+++ b/app/templates/exercise_export/exercise_user.html.erb
@@ -121,7 +121,7 @@
- <%= q.question_number %>、
+ <%= q.question_number %>、 <%= request.base_url %>
<%= q.question_type_name %>
@@ -167,41 +167,39 @@
<% end %>
- <% q_title = q.question_title&.html_safe %>
- <% if q_type == 5 %>
- <% q_name = q.shixun_name&.html_safe %>
-
<%= q_name&.include?("src=\"") ? q_name&.gsub("src=\"","src=\"#{@request_url}") : q_name %>
+ <% if q.question_type == 5 %>
+
<%= to_markdown(q.shixun_name) %>
- <%= q_title&.include?("src=\"") ? q_title&.gsub("src=\"","src=\"#{@request_url}") : q_title %>
+ <%= to_markdown(q.question_title) %>
<% else %>
-
<%= q_title&.include?("src=\"") ? q_title&.gsub("src=\"","src=\"#{@request_url}") : q_title %>
+
<%= to_markdown(q.question_title) %>
<% end %>
<% if q_type == 0 %>
- <% q.exercise_choices.each_with_index do |s,index| %>
+ <% q.exercise_choices.each do |s| %>
<% check_answer = (user_answer.present? && (s.id == user_answer.first.exercise_choice_id)) ? "choose-answer" : '' %>
-
-
- <%= convert_to_char((index+1).to_s)%><%= s.choice_text%>
-
+
+
+ <%= to_markdown(s.choice_text) %>
+
<% end %>
<% elsif q_type == 1 %>
- <% q.exercise_choices.each_with_index do |s,index| %>
+ <% q.exercise_choices.each do |s| %>
<% 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%>
-
+ <%= to_markdown(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' %>
@@ -213,7 +211,7 @@
<%= 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| %>
@@ -224,13 +222,13 @@
<% end %>
答案(填空<%= index+1 %>):
- <%= check_answer&.html_safe %>
+ <%= to_markdown(check_answer) %>
<% end %>
<% elsif q_type == 4 %>
<% check_answer = (user_answer.present? ? user_answer.first.answer_text : '--') %>
- <%= check_answer&.html_safe %>
+ <%= to_markdown(check_answer) %>
<% else %>
diff --git a/app/views/challenges/show.json.jbuilder b/app/views/challenges/show.json.jbuilder
index 332879eac..cffe77ebb 100644
--- a/app/views/challenges/show.json.jbuilder
+++ b/app/views/challenges/show.json.jbuilder
@@ -1,6 +1,6 @@
# 导航栏公共数据
json.partial! "challenges/top_common_data", shixun_identifier: @shixun.identifier
-json.(@challenge, :id, :subject, :task_pass, :difficulty, :score)
+json.(@challenge, :id, :subject, :task_pass, :difficulty, :score, :exec_time)
json.tags @challenge.challenge_tags.map(&:name)
diff --git a/app/views/shixuns/settings.json.jbuilder b/app/views/shixuns/settings.json.jbuilder
index e97331388..e81498058 100644
--- a/app/views/shixuns/settings.json.jbuilder
+++ b/app/views/shixuns/settings.json.jbuilder
@@ -22,13 +22,21 @@ json.shixun do
json.hide_code @shixun.hide_code # 隐藏代码窗口
json.code_hidden @shixun.code_hidden # 代码目录隐藏
json.vnc @shixun.vnc
- json.exec_time @shixun.exec_time
+ #json.exec_time @shixun.exec_time
json.webssh @shixun.webssh
json.multi_webssh @shixun.multi_webssh
json.use_scope @shixun.use_scope
json.scope_partment @shixun.schools.map(&:name) # 公开范围
json.opening_time @shixun.opening_time
json.forbid_copy @shixun.forbid_copy
+
+ # 实训服务配置
+ json.shixun_service_configs do
+ json.array! @configs do |config|
+ json.name config.mirror_repository&.name
+ json.(config, :cpu_limit, :lower_cpu_limit, :memory_limit, :request_limit, :mirror_repository_id)
+ end
+ end
end