优化N+1的问题

newyslclassrooms
daiao 5 years ago
parent 3cf27da3dc
commit 50d856fa1c

@ -80,7 +80,7 @@ class Challenge < ApplicationRecord
# end
def open_game shixun, user_id
game = self.games.where(user_id: user_id).first
game = self.games.map{|g| g.user_id == user_id}.first
if game.present?
shixun.task_pass || game.status != 3 ? "/tasks/#{game.identifier}" : ""
else

Loading…
Cancel
Save