diff --git a/app/controllers/exercise_bank_controller.rb b/app/controllers/exercise_bank_controller.rb
index e4fa6727..6b8090dd 100644
--- a/app/controllers/exercise_bank_controller.rb
+++ b/app/controllers/exercise_bank_controller.rb
@@ -104,6 +104,7 @@ class ExerciseBankController < ApplicationController
:question_type => params[:question_type] || 1,
:question_number => @exercise.exercise_bank_questions.count + 1,
:question_score => params[:question_score],
+ :shixun_name => params[:question_type] == '5' ? params[:shixun_name] : nil,
:shixun_id => params[:shixun],
:max_choices => params[:max_choices].to_i || 0,
:min_choices => params[:min_choices].to_i || 0
@@ -271,6 +272,7 @@ class ExerciseBankController < ApplicationController
end
end
if @exercise_question.question_type == 5
+ @exercise_question.shixun_name = params[:shixun_name].strip if !params[:shixun_name].blank?
question_score = 0
@exercise_question.exercise_bank_shixun_challenges.each_with_index do |challenge, index|
challenge.question_score = params[:question_score][index]
diff --git a/app/controllers/exercise_controller.rb b/app/controllers/exercise_controller.rb
index 23024a78..ee5705fb 100644
--- a/app/controllers/exercise_controller.rb
+++ b/app/controllers/exercise_controller.rb
@@ -372,6 +372,7 @@ class ExerciseController < ApplicationController
:question_type => params[:question_type] || 1,
:question_number => @exercise.exercise_questions.count + 1,
:question_score => params[:question_type] == '5' ? 0 : params[:question_score],
+ :shixun_name => params[:question_type] == '5' ? params[:shixun_name] : nil,
:shixun_id => params[:shixun]
}
@exercise_questions = @exercise.exercise_questions.new option
@@ -512,6 +513,7 @@ class ExerciseController < ApplicationController
end
end
if @exercise_question.question_type == 5
+ @exercise_question.shixun_name = params[:shixun_name].strip if !params[:shixun_name].blank?
question_score = 0
@exercise_question.exercise_shixun_challenges.each_with_index do |challenge, index|
challenge.question_score = params[:question_score][index]
@@ -1508,7 +1510,8 @@ class ExerciseController < ApplicationController
:question_type => q[:question_type] || 1,
:question_number => q[:question_number],
:question_score => q[:question_score],
- :shixun_id => q[:shixun_id]
+ :shixun_id => q[:shixun_id],
+ :shixun_name => q[:shixun_name]
}
exercise_bank_question = exercise_bank.exercise_bank_questions.new option
diff --git a/app/controllers/question_banks_controller.rb b/app/controllers/question_banks_controller.rb
index 96f6db3b..cffecba1 100644
--- a/app/controllers/question_banks_controller.rb
+++ b/app/controllers/question_banks_controller.rb
@@ -117,7 +117,7 @@ class QuestionBanksController < ApplicationController
else
@courses = User.current.courses.where("is_delete = 0 and is_end = 0").select{ |course| User.current.has_teacher_role(course)}
end
- @homework_ids = params[:check_homework_bank] || params[:bank_id].split(" ")
+ @homework_ids = params[:check_homework_bank] || params[:bank_id].split(" ") unless params[:is_observe]
@search = params[:search]
respond_to do |format|
format.js
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 35449aad..34fa1a8d 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -7034,7 +7034,8 @@ def quote_exercise_bank exercise, course
:question_type => q[:question_type] || 1,
:question_number => q[:question_number],
:question_score => q[:question_score],
- :shixun_id => q[:shixun_id]
+ :shixun_id => q[:shixun_id],
+ :shixun_name => q[:shixun_name]
}
exercise_question = new_exercise.exercise_questions.new option
diff --git a/app/views/exercise/_edit_shixun.html.erb b/app/views/exercise/_edit_shixun.html.erb
index 9c0f130b..ef96f3b7 100644
--- a/app/views/exercise/_edit_shixun.html.erb
+++ b/app/views/exercise/_edit_shixun.html.erb
@@ -3,7 +3,7 @@
实训题
-
+
diff --git a/app/views/exercise/_exercise_form.html.erb b/app/views/exercise/_exercise_form.html.erb
index ca3080e4..bee149fd 100644
--- a/app/views/exercise/_exercise_form.html.erb
+++ b/app/views/exercise/_exercise_form.html.erb
@@ -111,7 +111,7 @@
var score = $.trim($("#poll_question_score_"+ id).val());
var standard_ans = $.trim($("#exercise_choice_" + id).val());
if(name===""){
- notice_box("题目标题");
+ notice_box("题目标题不能为空");
}
if(title.length == 0 || score.length == 0){
notice_box("要求/分数不能为空");
diff --git a/app/views/exercise/_exercise_student.html.erb b/app/views/exercise/_exercise_student.html.erb
index add9d655..ec47f1c0 100644
--- a/app/views/exercise/_exercise_student.html.erb
+++ b/app/views/exercise/_exercise_student.html.erb
@@ -162,7 +162,7 @@
<% end %>
<% if exercise_question.question_type == 5 %>
- <%= exercise_question.shixun.name %>
+ <%= exercise_question.shixun_name %>
<% end %>
<%= exercise_question.question_title.html_safe %>
<% case exercise_question.question_type %>
diff --git a/app/views/exercise/_exercise_student_result.html.erb b/app/views/exercise/_exercise_student_result.html.erb
index 0dd656be..6d48573f 100644
--- a/app/views/exercise/_exercise_student_result.html.erb
+++ b/app/views/exercise/_exercise_student_result.html.erb
@@ -140,7 +140,7 @@
<% end %>
<% if exercise_question.question_type == 5 %>
- <%= exercise_question.shixun.name %>
+ <%= exercise_question.shixun_name %>
<% end %>
<%= exercise_question.question_title.html_safe %>
<% case exercise_question.question_type %>
diff --git a/app/views/exercise/_new_shixun.html.erb b/app/views/exercise/_new_shixun.html.erb
index 1cff068f..6ce2cd68 100644
--- a/app/views/exercise/_new_shixun.html.erb
+++ b/app/views/exercise/_new_shixun.html.erb
@@ -8,7 +8,10 @@
- <%= @shixun.name %>
+
+
+
+
diff --git a/app/views/exercise/_show_shixun.html.erb b/app/views/exercise/_show_shixun.html.erb
index 92feef9d..75f460ec 100644
--- a/app/views/exercise/_show_shixun.html.erb
+++ b/app/views/exercise/_show_shixun.html.erb
@@ -16,7 +16,7 @@
<% end %>
- <%= exercise_question.shixun.name %>
+ <%= exercise_question.shixun_name %>
<%= exercise_question.question_title.html_safe %>
<% exercise_question.exercise_shixun_challenges.each_with_index do |exercise_challenge,index| %>
diff --git a/app/views/exercise/student_exercise_list.html.erb b/app/views/exercise/student_exercise_list.html.erb
index 3632b4d7..b8335515 100644
--- a/app/views/exercise/student_exercise_list.html.erb
+++ b/app/views/exercise/student_exercise_list.html.erb
@@ -256,7 +256,7 @@
<% end %>
<% if exercise_question.question_type == 5 %>
- <%= exercise_question.shixun.name %>
+ <%= exercise_question.shixun_name %>
<% end %>
<%= exercise_question.question_title.html_safe %>
diff --git a/app/views/exercise_bank/_edit_shixun.html.erb b/app/views/exercise_bank/_edit_shixun.html.erb
index 41383767..7aa84e9f 100644
--- a/app/views/exercise_bank/_edit_shixun.html.erb
+++ b/app/views/exercise_bank/_edit_shixun.html.erb
@@ -1,7 +1,10 @@
<%= form_for("",:url => update_exercise_question_exercise_bank_index_path(:exercise_question => exercise_question.id),:html => {:id => "update_exercise_question_#{exercise_question.id}"}) do |f|%>
实训题
-
<%= exercise_question.shixun.name %>
+
+
+
+
diff --git a/app/views/exercise_bank/_new_shixun.html.erb b/app/views/exercise_bank/_new_shixun.html.erb
index 36af84ad..140ee9b2 100644
--- a/app/views/exercise_bank/_new_shixun.html.erb
+++ b/app/views/exercise_bank/_new_shixun.html.erb
@@ -8,7 +8,10 @@
- <%= @shixun.name %>
+
+
+
+
diff --git a/app/views/exercise_bank/_show_shixun.html.erb b/app/views/exercise_bank/_show_shixun.html.erb
index cf2a9b2b..e426fd0e 100644
--- a/app/views/exercise_bank/_show_shixun.html.erb
+++ b/app/views/exercise_bank/_show_shixun.html.erb
@@ -14,7 +14,7 @@
-
<%= exercise_question.shixun.name %>
+
<%= exercise_question.shixun_name %>
<%= exercise_question.question_title.html_safe %>
<% exercise_question.exercise_bank_shixun_challenges.each_with_index do |exercise_challenge,index| %>
diff --git a/app/views/exercise_bank/show.html.erb b/app/views/exercise_bank/show.html.erb
index 0fb5e2ca..14712a92 100644
--- a/app/views/exercise_bank/show.html.erb
+++ b/app/views/exercise_bank/show.html.erb
@@ -80,7 +80,7 @@
<% end %>
<% if exercise_question.question_type == 5 %>
-
<%= exercise_question.shixun.name %>
+
<%= exercise_question.shixun_name %>
<% end %>
<%= exercise_question.question_title.html_safe %>
<% case exercise_question.question_type %>
diff --git a/app/views/homework_bank/_send_homework_bank.html.erb b/app/views/homework_bank/_send_homework_bank.html.erb
index 3127aecd..6b935521 100644
--- a/app/views/homework_bank/_send_homework_bank.html.erb
+++ b/app/views/homework_bank/_send_homework_bank.html.erb
@@ -31,4 +31,17 @@
-
\ No newline at end of file
+
+
+
\ No newline at end of file
diff --git a/db/migrate/20190529014121_add_shixun_name_to_ex_question.rb b/db/migrate/20190529014121_add_shixun_name_to_ex_question.rb
new file mode 100644
index 00000000..8aa02878
--- /dev/null
+++ b/db/migrate/20190529014121_add_shixun_name_to_ex_question.rb
@@ -0,0 +1,14 @@
+class AddShixunNameToExQuestion < ActiveRecord::Migration
+ def change
+ add_column :exercise_questions, :shixun_name, :string
+ add_column :exercise_bank_questions, :shixun_name, :string
+
+ ExerciseQuestion.where(question_type: 5).each do |question|
+ question.update_column("shixun_name", question.shixun.try(:name))
+ end
+
+ ExerciseBankQuestion.where(question_type: 5).each do |question|
+ question.update_column("shixun_name", question.shixun.try(:name))
+ end
+ end
+end
diff --git a/public/javascripts/edu/base_edu.js b/public/javascripts/edu/base_edu.js
index 8167249c..1963d1cb 100644
--- a/public/javascripts/edu/base_edu.js
+++ b/public/javascripts/edu/base_edu.js
@@ -1361,16 +1361,6 @@ function choose_course_to_send_hb(){
}
}
-function search_hw_course(url){
- $.ajax({
- url: url,
- type: 'post',
- data: {search: $("#hb_search_course_input").val(), is_observe: true},
- success: function(data){
- }
- });
-}
-
function submit_send_hb_to_course(){
if($("input[name='course_id']:checked").length >= 1){
$("#search_course_notice_h").html("").hide();
diff --git a/public/javascripts/edu/course.js b/public/javascripts/edu/course.js
index 330dbea7..98163bda 100644
--- a/public/javascripts/edu/course.js
+++ b/public/javascripts/edu/course.js
@@ -1103,6 +1103,15 @@ function add_ex_question(doc,quest_type)
var title = $.trim($("#poll_questions_title").val());
var score = $.trim($("#question_score").val());
var standard_ans = $.trim($("#exercise_choice_" + quest_type).val());
+
+ if (quest_type == 5) {
+ var name = $.trim($("#poll_questions_name").val());
+ if(name===""){
+ notice_box("题目标题不能为空");
+ result = false;
+ }
+ }
+
if(title.length == 0){
if(quest_type != 5){
notice_box("题目标题不能为空");
@@ -1414,6 +1423,13 @@ function edit_poll_question(doc,id,quest_type) {
var title = $.trim($("#poll_questions_title_" + id).val());
var score = $.trim($("#poll_question_score_" + id).val());
var standard_ans = $.trim($("#exercise_choice_" + id).val());
+ if (quest_type == 5) {
+ var name = $.trim($("#poll_questions_name_" + id).val());
+ if(name===""){
+ notice_box("题目标题不能为空");
+ result = false;
+ }
+ }
if (title.length == 0) {
if (quest_type != 5) {
notice_box("题目标题不能为空");