From b51c899cb558e79d13721b0e1771a1b1267d2922 Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Fri, 28 Jun 2019 14:22:30 +0800 Subject: [PATCH] =?UTF-8?q?challenge=20index=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/challenge.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/challenge.rb b/app/models/challenge.rb index f25ce330a..9bfb89b4b 100644 --- a/app/models/challenge.rb +++ b/app/models/challenge.rb @@ -97,12 +97,12 @@ class Challenge < ApplicationRecord # 关卡用户通关数 def user_passed_count - games.select{|game| game.status == 2}.size + games.where(status: 2).count end # 关卡用户正在挑战的人数 def playing_count - games.select{|game| game.status == 0 || game.status == 1}.size + games.where(status: [0, 1]).count end def last_challenge