diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index 2c4f2a7d1..4afba7a7b 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -522,7 +522,13 @@ class ShixunsController < ApplicationController end # 如果存在实训,则直接进入实训 - @current_task = current_myshixun.current_task(games) + # 如果实训允许跳关,传参params[:challenge_id]跳入具体的关卡 + @current_task = + if params[:challenge_id] && @shixun.task_pass + current_myshixun.games.where(challenge_id: params[:challenge_id]).take + else + current_myshixun.current_task(games) + end else # 如果未创建关卡一定不能开启实训,否则TPI没法找到当前的关卡 if @shixun.challenges_count == 0 diff --git a/app/views/challenges/index.json.jbuilder b/app/views/challenges/index.json.jbuilder index 6b92be411..37ce94305 100644 --- a/app/views/challenges/index.json.jbuilder +++ b/app/views/challenges/index.json.jbuilder @@ -17,7 +17,7 @@ if @challenges.present? json.passed_count challenge.user_passed_count json.playing_count challenge.playing_count json.name_url shixun_challenge_path(challenge, shixun_identifier: @shixun.identifier) - json.open_game challenge.open_game(@user.id, @shixun) + #json.open_game challenge.open_game(@user.id, @shixun) if @editable json.edit_url edit_shixun_challenge_path(challenge, shixun_identifier: @shixun.identifier) json.delete_url shixun_challenge_path(challenge, shixun_identifier: @shixun.identifier)