Ignore provisional ratings when displaying team's 'Best players'

Closes #721
pull/3809/head
Anton Baklanov 2017-11-17 20:03:40 -03:00
parent b82cb949f3
commit 11d4cb4339
No known key found for this signature in database
GPG Key ID: FAB86189162EBA77
2 changed files with 4 additions and 4 deletions

View File

@ -34,7 +34,7 @@ final class TeamInfoApi(
private def fetchCachable(id: String): Fu[Cachable] = for {
userIds (MemberRepo userIdsByTeam id)
bestUserIds UserRepo.idsByIdsSortRating(userIds, 10)
bestUserIds UserRepo.ratedIdsByIdsSortRating(userIds, 10)
toints UserRepo.idsSumToints(userIds)
} yield Cachable(bestUserIds, toints)

View File

@ -93,12 +93,12 @@ object UserRepo {
.list[User](nb, ReadPreference.secondaryPreferred)
// expensive, send to secondary
def idsByIdsSortRating(ids: Iterable[ID], nb: Int): Fu[List[User.ID]] =
def ratedIdsByIdsSortRating(ids: Iterable[ID], nb: Int): Fu[List[User.ID]] =
coll.find(
$inIds(ids) ++ goodLadSelectBson,
$inIds(ids) ++ goodLadSelectBson ++ $doc("perfs.standard" $exists true),
$id(true)
)
.sort($doc(s"perfs.standard.gl.r" -> -1))
.sort($sort desc "perfs.standard.gl.r")
.list[Bdoc](nb, ReadPreference.secondaryPreferred).map {
_.flatMap { _.getAs[User.ID]("_id") }
}