From 831b1937f98eeb529283db11bae76f7cc8dff4c7 Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Sat, 29 Jun 2019 10:57:24 +0800 Subject: [PATCH] =?UTF-8?q?challenge=E6=98=BE=E7=A4=BA=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/challenges_controller.rb | 4 ++-- app/controllers/shixuns_controller.rb | 5 ----- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/app/controllers/challenges_controller.rb b/app/controllers/challenges_controller.rb index 2ba76c60a..afe0e14b6 100644 --- a/app/controllers/challenges_controller.rb +++ b/app/controllers/challenges_controller.rb @@ -151,8 +151,8 @@ class ChallengesController < ApplicationController def index uid_logger("identifier: #{params}") # 通过调试发现 这里includes(:games)性能会慢10倍 - - @challenges = @shixun.challenges.fields_for_list.includes(:games).where("games.user_id" => current_user.id) + current_myshixun = @shixun.current_myshixun(current_user.id) + @challenges = @shixun.challenges.includes(:games).where("games.user_id" => (current_myshixun ? current_user.id : nil)) @editable = current_user.manager_of_shixun?(@shixun) && @shixun.status == 0 @user = current_user diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index 73029706f..b3069bc5d 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -553,11 +553,6 @@ class ShixunsController < ApplicationController end end - # REDO:开启实训时更新关联作品的状态 - # TODO:这个可以异步。或者放到课程里面取,不要在开启实训这边做 - # HomeworksService.new.update_myshixun_work_status myshixun - UpdateMyshixunWorkStatusJob.perform_later(myshixun.id) - @current_task = myshixun.current_task(myshixun.games) uid_logger("## shixun exec: myshixun id is #{myshixun.id}") rescue Exception => e