From e6cb59cfef53dd885196a0f100aa6f14654ef552 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Mon, 29 Jul 2019 17:50:03 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9E=E8=AE=AD=E8=B7=AF=E5=BE=84=E6=8A=A5?= =?UTF-8?q?=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/myshixun.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/models/myshixun.rb b/app/models/myshixun.rb index b5e9df62..74841156 100644 --- a/app/models/myshixun.rb +++ b/app/models/myshixun.rb @@ -129,7 +129,8 @@ class Myshixun < ActiveRecord::Base if current_game.blank? current_game = Game.find_by_sql("SELECT g.* FROM games g, challenges c where g.myshixun_id=#{self.id} and g.challenge_id = c.id and g.status = 2 order by c.position desc").first end - return current_game + + return current_game.blank? ? games.first : current_game # # if self.status == 1 # current_game = Game.find_by_sql("SELECT g.* FROM games g, challenges c where g.myshixun_id=#{self.id} and g.challenge_id = c.id and g.status = 2 order by c.position desc").first