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