diff --git a/app/controllers/commons_controller.rb b/app/controllers/commons_controller.rb index 105cbefbe..1f6dce053 100644 --- a/app/controllers/commons_controller.rb +++ b/app/controllers/commons_controller.rb @@ -45,7 +45,7 @@ class CommonsController < ApplicationController code = case params[:object_type].strip when 'message' - if current_user.course_identity(@object.board.course) >= 5 || @object.author != current_user + if current_user.course_identity(@object.board.course) >= 5 && @object.author != current_user 403 else 200 @@ -53,7 +53,7 @@ class CommonsController < ApplicationController else current_user.admin? ? 200 : 403 end - return normal_status(403, "你没有权限操作!") if code == 403 + return normal_status(code, "你没有权限操作!") if code == 403 end def action(flag) diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index f7172021c..0d913a0a1 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -733,14 +733,14 @@ class ShixunsController < ApplicationController private def shixun_params - raise("实训名称不能为空") if params[:name].blank? + raise("实训名称不能为空") if params[:shixun][:name].blank? params.require(:shixun).permit(:name, :trainee, :webssh, :can_copy, :use_scope, :vnc, :test_set_permission, :task_pass, :repo_name, :multi_webssh, :opening_time, :mirror_script_id, :code_hidden, :hide_code, :forbid_copy) end def shixun_info_params - raise("实训描述不能为空") if params[:description].blank? - raise("评测脚本不能为空") if params[:evaluate_script].blank? + raise("实训描述不能为空") if params[:shixun_info][:description].blank? + raise("评测脚本不能为空") if params[:shixun_info][:evaluate_script].blank? params.require(:shixun_info).permit(:description, :evaluate_script) end diff --git a/app/models/challenge.rb b/app/models/challenge.rb index 18b177e1c..e7a382a51 100644 --- a/app/models/challenge.rb +++ b/app/models/challenge.rb @@ -52,7 +52,7 @@ class Challenge < ApplicationRecord # 开启挑战 def open_game user_id, shixun - game = self.games.first + game = self.games.where(user_id: user_id).first if game.present? shixun.task_pass || game.status != 3 ? "/tasks/#{game.identifier}" : "" else diff --git a/app/services/exercise_user_pdf_service.rb b/app/services/exercise_user_pdf_service.rb index 44ee1e769..ee055ac66 100644 --- a/app/services/exercise_user_pdf_service.rb +++ b/app/services/exercise_user_pdf_service.rb @@ -41,7 +41,7 @@ class ExerciseUserPdfService # #-----正式需删掉 # aa = File.open(Rails.root.join("public/123.html"),"w+") # aa.syswrite(kit.source) - # #正式需删掉------- + # #正式需删掉-------s file = Tempfile.new(filename) kit.to_pdf(file.path) file diff --git a/app/templates/exercise_export/blank_exercise.html.erb b/app/templates/exercise_export/blank_exercise.html.erb index 153ba1514..759a2d2b0 100644 --- a/app/templates/exercise_export/blank_exercise.html.erb +++ b/app/templates/exercise_export/blank_exercise.html.erb @@ -94,7 +94,7 @@ <% elsif q.question_type == 2 %>
+
- <%= to_markdown(check_answer) %> -
+@@ -326,6 +334,7 @@