diff --git a/app/controllers/exercise_controller.rb b/app/controllers/exercise_controller.rb index 0b1a035c1..6066ef3d0 100644 --- a/app/controllers/exercise_controller.rb +++ b/app/controllers/exercise_controller.rb @@ -302,6 +302,7 @@ class ExerciseController < ApplicationController # 发布试卷 def publish_exercise @is_teacher = User.current.allowed_to?(:as_teacher,@course) + @index = params[:index] @exercise.exercise_status = 2 @exercise.publish_time = Time.now if @exercise.save @@ -316,11 +317,13 @@ class ExerciseController < ApplicationController # 重新发布的时候会删除所有的答题 def republish_exercise @is_teacher = User.current.allowed_to?(:as_teacher,@course) + @index = params[:index] @exercise.exercise_questions.each do |exercise_question| exercise_question.exercise_answers.destroy_all end @exercise.exercise_users.destroy_all @exercise.exercise_status = 1 + @exercise.publish_time = nil @exercise.save respond_to do |format| format.js diff --git a/app/views/exercise/_exercise.html.erb b/app/views/exercise/_exercise.html.erb index ba82fbf82..91af83aee 100644 --- a/app/views/exercise/_exercise.html.erb +++ b/app/views/exercise/_exercise.html.erb @@ -8,7 +8,7 @@ <%# else %> <%#= link_to poll_name, exercise_path(poll.id), :class => "polls_title polls_title_w fl c_dblue" %> <%# end %> - <%= link_to (index+1).to_s+". "+exercise_name, exercise_path(exercise.id), :class => "polls_title polls_title_w fl c_dblue" %> + <%= link_to (index.to_i+1).to_s+". "+exercise_name, exercise_path(exercise.id), :class => "polls_title polls_title_w fl c_dblue" %> @@ -24,9 +24,9 @@ <%# end%> <% if exercise.exercise_status == 1 %> -
取消发布后学生答题将会被清空
是否确定取消发布该测验?
测验发布后将不能对测验进行修改,
是否确定发布该测验?