From bb5ee12a90adaff53d6e09091b16cbfb4bd78d9d Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Thu, 26 Mar 2020 15:00:44 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BC=96=E7=A8=8B=E9=A2=98=E7=9A=84=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/examination_banks_controller.rb | 2 +- app/controllers/exercise_questions_controller.rb | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/controllers/examination_banks_controller.rb b/app/controllers/examination_banks_controller.rb index a51bcf5a4..4cb25aa29 100644 --- a/app/controllers/examination_banks_controller.rb +++ b/app/controllers/examination_banks_controller.rb @@ -83,7 +83,7 @@ class ExaminationBanksController < ApplicationController end def send_to_course - # tip_exception(403, "无权限") unless @exam.public || @exam.user == current_user + tip_exception(403, "无权限") unless @exam.public || @exam.user == current_user course = Course.find params[:course_id] exercise = Exercise.new(user_id: current_user.id, course_id: course.id) exercise = ExaminationBanks::SendToCourseService.call(@exam, exercise) diff --git a/app/controllers/exercise_questions_controller.rb b/app/controllers/exercise_questions_controller.rb index 00c158a4b..61a1386fc 100644 --- a/app/controllers/exercise_questions_controller.rb +++ b/app/controllers/exercise_questions_controller.rb @@ -340,12 +340,10 @@ class ExerciseQuestionsController < ApplicationController @exercise_question.question_score = question_score @exercise_question.shixun_name = shixun_name @exercise_question.save! - # elsif @exercise_question.question_type == Exercise::PROGRAM - # question_score = 0 - # shixun_name = params[:shixun_name] || @exercise_question.shixun_name - # @exercise_question.question_score = question_score - # @exercise_question.shixun_name = shixun_name - # @exercise_question.save! + elsif @exercise_question.question_type == Exercise::PROGRAM + if @exercise_question.hack.present? + @exercise_question.hack.update!(name: params[:question_title], description: params[:description]) + end end #当试卷已发布时(试卷的总状态),当标准答案修改时,如有已提交的学生,需重新计算分数. @@ -753,6 +751,8 @@ class ExerciseQuestionsController < ApplicationController elsif params[:shixun_name].blank? normal_status(-1, "实训题名称不能为空!") end + elsif params[:question_type].to_i == 6 + normal_status(-1, "编程题描述不能为空!") if params[:description].blank? end end