From 233965ddca435fb4d350ca135038ac67925f4080 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Thu, 4 Jul 2019 08:58:01 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=BC=80=E5=90=AF=E5=AE=9E=E8=AE=AD?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/shixuns_controller.rb | 8 +++++++- app/views/challenges/index.json.jbuilder | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) 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) From 21c8e0eae856a916ec18c11eab516b27fc95e101 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Thu, 4 Jul 2019 09:22:01 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=BC=80=E5=90=AF=E5=85=B3=E5=8D=A1?= =?UTF-8?q?=E6=9C=89=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/shixuns_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index 4afba7a7b..1c6476a34 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -525,7 +525,7 @@ class ShixunsController < ApplicationController # 如果实训允许跳关,传参params[:challenge_id]跳入具体的关卡 @current_task = if params[:challenge_id] && @shixun.task_pass - current_myshixun.games.where(challenge_id: params[:challenge_id]).take + games.where(challenge_id: params[:challenge_id]).take else current_myshixun.current_task(games) end