ponder game estimated duration in user top perfs
parent
d97326e79d
commit
8e60db9277
|
@ -1,5 +1,7 @@
|
|||
package lila.rating
|
||||
|
||||
import lila.common.Centis
|
||||
|
||||
import chess.Speed
|
||||
|
||||
sealed abstract class PerfType(
|
||||
|
@ -186,6 +188,17 @@ object PerfType {
|
|||
case _ => none
|
||||
}
|
||||
|
||||
lazy val totalTimeRoughEstimation: Map[PerfType, Centis] = nonPuzzle.map { pt =>
|
||||
pt -> Centis(pt match {
|
||||
case UltraBullet => 25 * 100
|
||||
case Bullet => 90 * 100
|
||||
case Blitz => 7 * 60 * 100
|
||||
case Classical => 15 * 60 * 100
|
||||
case Correspondence => 60 * 60 * 100
|
||||
case _ => 7 * 60 * 100
|
||||
})
|
||||
}(scala.collection.breakOut)
|
||||
|
||||
def iconByVariant(variant: chess.variant.Variant): Char =
|
||||
byVariant(variant).fold('C')(_.iconChar)
|
||||
}
|
||||
|
|
|
@ -82,7 +82,9 @@ case class User(
|
|||
def lightCount = User.LightCount(light, count.game)
|
||||
|
||||
private def best4Of(perfTypes: List[PerfType]) =
|
||||
perfTypes.sortBy { pt => -perfs(pt).nb } take 4
|
||||
perfTypes.sortBy { pt =>
|
||||
-(perfs(pt).nb * PerfType.totalTimeRoughEstimation.get(pt).fold(0)(_.value))
|
||||
} take 4
|
||||
|
||||
private val firstRow = List(PerfType.Bullet, PerfType.Blitz, PerfType.Classical, PerfType.Correspondence)
|
||||
private val secondRow = List(PerfType.UltraBullet, PerfType.Crazyhouse, PerfType.Chess960, PerfType.KingOfTheHill, PerfType.ThreeCheck, PerfType.Antichess, PerfType.Atomic, PerfType.Horde, PerfType.RacingKings)
|
||||
|
|
Loading…
Reference in New Issue