|
|
|
@ -20,9 +20,9 @@ class Game < ApplicationRecord
|
|
|
|
|
#全部关卡数
|
|
|
|
|
scope :ch_games, lambda { |challenge_id| where(challenge_id:challenge_id) }
|
|
|
|
|
# 已通关的数量
|
|
|
|
|
scope :finished_num, -> (challenge_id) { where(:challenge_id => challenge_id, :status => 1)}
|
|
|
|
|
scope :finished_num, -> (challenge_id) { where(:challenge_id => challenge_id, :status => 2)}
|
|
|
|
|
# 正在通关的数量
|
|
|
|
|
scope :doing_num, -> (challenge_id) { where(:challenge_id => challenge_id, :status => 0)}
|
|
|
|
|
scope :doing_num, -> (challenge_id) { where(:challenge_id => challenge_id, :status => [0,1])}
|
|
|
|
|
|
|
|
|
|
#用户的全部关卡
|
|
|
|
|
scope :user_games, lambda { |user_id,challenge_id| where("user_id = ? AND challenge_id = ?",user_id,challenge_id) }
|
|
|
|
|