|
|
@ -77,14 +77,17 @@ class Challenge < ApplicationRecord
|
|
|
|
def user_tpi_status user_id
|
|
|
|
def user_tpi_status user_id
|
|
|
|
# todo: 以前没加索引导致相同关卡,同一用户有多个games
|
|
|
|
# todo: 以前没加索引导致相同关卡,同一用户有多个games
|
|
|
|
# 允许跳关则直接开启
|
|
|
|
# 允许跳关则直接开启
|
|
|
|
return 1 if shixun.task_pass
|
|
|
|
|
|
|
|
game = games.where(user_id: user_id).take
|
|
|
|
game = games.where(user_id: user_id).take
|
|
|
|
if game.blank?
|
|
|
|
if game.blank?
|
|
|
|
self.position == 1 ? 1 : 0
|
|
|
|
self.position == 1 ? 1 : 0
|
|
|
|
elsif game.status == 2
|
|
|
|
elsif game.status == 2
|
|
|
|
2
|
|
|
|
2
|
|
|
|
else
|
|
|
|
else
|
|
|
|
|
|
|
|
if shixun.task_pass
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|