challenge index优化

dev_forum
jingquan huang 5 years ago
parent c8bfb0b4c1
commit b51c899cb5

@ -97,12 +97,12 @@ class Challenge < ApplicationRecord
# 关卡用户通关数 # 关卡用户通关数
def user_passed_count def user_passed_count
games.select{|game| game.status == 2}.size games.where(status: 2).count
end end
# 关卡用户正在挑战的人数 # 关卡用户正在挑战的人数
def playing_count def playing_count
games.select{|game| game.status == 0 || game.status == 1}.size games.where(status: [0, 1]).count
end end
def last_challenge def last_challenge

Loading…
Cancel
Save