diff --git a/app/controllers/exercise_controller.rb b/app/controllers/exercise_controller.rb index 1598030a2..6fcbb0c6c 100644 --- a/app/controllers/exercise_controller.rb +++ b/app/controllers/exercise_controller.rb @@ -65,7 +65,6 @@ class ExerciseController < ApplicationController :end_time => "", :publish_time => "", :exercise_description => "", - :show_result => "", :show_result => 1 } @exercise = Exercise.create option @@ -104,10 +103,10 @@ class ExerciseController < ApplicationController def update @exercise.exercise_name = params[:exercise][:exercise_name] @exercise.exercise_description = params[:exercise][:exercise_description] - @exercise.time = params[:exercise][:time] + @exercise.time = params[:exercise][:time].blank? ? -1 : params[:exercise][:time] @exercise.end_time = params[:exercise][:end_time] @exercise.publish_time = params[:exercise][:publish_time] - @exercise.show_result = params[:exercise][:show_result] + @exercise.show_result = params[:exercise][:show_result].blank? ? 1 : params[:exercise][:show_result] if @exercise.save respond_to do |format| format.js diff --git a/app/views/exercise/_edit_head.html.erb b/app/views/exercise/_edit_head.html.erb index 3090cc2c5..6c357130c 100644 --- a/app/views/exercise/_edit_head.html.erb +++ b/app/views/exercise/_edit_head.html.erb @@ -6,18 +6,17 @@ <%# if edit_mode %> <%# end %> -
- " > - <%= calendar_for('exercise_publish_time')%> -
- <%# if edit_mode %> - - <%# end %> +
- " > + "/> <%= calendar_for('exercise_end_time')%>
-
测验时长:分钟
+
测验时长:分钟
+ +
+ "/> + <%= calendar_for('exercise_publish_time')%> +