only save leaderboardable perf types in rankings
parent
6abfc8dccd
commit
3cf76bad3f
|
@ -234,6 +234,7 @@ object PerfType {
|
|||
Horde,
|
||||
RacingKings
|
||||
)
|
||||
val isLeaderboardable = leaderboardable.toSet
|
||||
val variants: List[PerfType] =
|
||||
List(Crazyhouse, Chess960, KingOfTheHill, ThreeCheck, Antichess, Atomic, Horde, RacingKings)
|
||||
val standard: List[PerfType] = List(Bullet, Blitz, Rapid, Classical, Correspondence)
|
||||
|
|
|
@ -27,7 +27,7 @@ final class RankingApi(
|
|||
}
|
||||
|
||||
def save(user: User, perfType: PerfType, perf: Perf): Funit =
|
||||
(user.rankable && perf.nb >= 2) ?? coll {
|
||||
(user.rankable && perf.nb >= 2 && PerfType.isLeaderboardable(perfType)) ?? coll {
|
||||
_.update
|
||||
.one(
|
||||
$id(makeId(user.id, perfType)),
|
||||
|
@ -52,7 +52,7 @@ final class RankingApi(
|
|||
s"$userId:${perfType.id}"
|
||||
|
||||
private[user] def topPerf(perfId: Perf.ID, nb: Int): Fu[List[User.LightPerf]] =
|
||||
PerfType.id2key(perfId).filter(PerfType.leaderboardable.contains) ?? { perfKey =>
|
||||
PerfType.id2key(perfId).filter(k => PerfType(k).exists(PerfType.isLeaderboardable)) ?? { perfKey =>
|
||||
coll {
|
||||
_.find($doc("perf" -> perfId, "stable" -> true))
|
||||
.sort($doc("rating" -> -1))
|
||||
|
|
Loading…
Reference in New Issue