rename Slow to Classical

This commit is contained in:
Thibault Duplessis 2014-07-28 01:04:16 +02:00
parent 4c9b3a667d
commit 90208cbdd5
18 changed files with 55 additions and 55 deletions

View file

@ -104,7 +104,7 @@ object User extends LilaController {
online env.cached topOnline 30
bullet env.cached topBullet nb
blitz env.cached topBlitz nb
slow env.cached topSlow nb
classical env.cached topClassical nb
active env.cached topNbGame nb map2 { (user: UserModel) =>
user -> user.count.game
}
@ -124,7 +124,7 @@ object User extends LilaController {
online = online,
bullet = bullet,
blitz = blitz,
slow = slow,
classical = classical,
nb = active,
nbDay = activeDay,
nbWeek = activeWeek)

View file

@ -14,7 +14,7 @@
<ul>
<li>
<h2>Piece animation</h2>
@base.radios(form("animation"), Seq(0 -> "None", 1 -> "Fast", 2 -> "Normal", 3 -> "Slow"))
@base.radios(form("animation"), Seq(0 -> "None", 1 -> "Fast", 2 -> "Normal", 3 -> "Classical"))
</li>
<li>
<h2>Show captured pieces</h2>

View file

@ -1,4 +1,4 @@
@(progressDay: List[User], tourneyWinners: List[lila.tournament.Winner], toint: List[User], rating: List[User], ratingDay: List[User], ratingWeek: List[User], online: List[User], bullet: List[User], blitz: List[User], slow: List[User], nb: List[(User, Int)], nbDay: List[(User, Int)], nbWeek: List[(User, Int)])(implicit ctx: Context)
@(progressDay: List[User], tourneyWinners: List[lila.tournament.Winner], toint: List[User], rating: List[User], ratingDay: List[User], ratingWeek: List[User], online: List[User], bullet: List[User], blitz: List[User], classical: List[User], nb: List[(User, Int)], nbDay: List[(User, Int)], nbWeek: List[(User, Int)])(implicit ctx: Context)
@side = {
<div class="side">
@ -61,7 +61,7 @@
<div class="group">
@user.top(bullet, trans.bestBulletPlayers())(u => Html(s"<td>${u.perfs.bullet.glicko.intRating}</td>"))
@user.top(blitz, trans.bestBlitzPlayers())(u => Html(s"<td>${u.perfs.blitz.glicko.intRating}</td>"))
@user.top(slow, trans.bestSlowPlayers(), true)(u => Html(s"<td>${u.perfs.slow.glicko.intRating}</td>"))
@user.top(classical, trans.bestClassicalPlayers(), true)(u => Html(s"<td>${u.perfs.classical.glicko.intRating}</td>"))
</div>
</div>

View file

@ -30,7 +30,7 @@
<br />
@showPerf("bullet", u.perfs.bullet)
@showPerf("blitz", u.perfs.blitz)
@showPerf("slow", u.perfs.slow)
@showPerf("classical", u.perfs.classical)
<br />
@showPerf("chess960", u.perfs.chess960)
@showPerf("KingOfTheHill", u.perfs.kingOfTheHill)

View file

@ -262,7 +262,7 @@ activeThisWeek=Aktivaj ĉisemajne
activePlayers=Aktivaj ludantoj
bestBulletPlayers=Plej bonaj rapidegaj ludistoj
bestBlitzPlayers=Plej bonaj rapidaj ludistoj
bestSlowPlayers=Plej bonaj malrapidaj ludistoj
blestClassicalPlayers=Plej bonaj malrapidaj ludistoj
bewareTheGameIsRatedButHasNoClock=Atentu: la partio estas rankumita, sed ne havas tempolimiton!
training=Trejnado
yourPuzzleRatingX=Puzlo-poentoj: %s

View file

@ -262,7 +262,7 @@ activeThisWeek=Aktivni oveg tjedna
activePlayers=Aktivni igrači
bestBulletPlayers=Najbolji bullet igrači
bestBlitzPlayers=Najbolji blitz igrači
bestSlowPlayers=Najbolji spori igrači
blestClassicalPlayers=Najbolji spori igrači
bewareTheGameIsRatedButHasNoClock=Oprez, igra se za bodove ali ne i na vreme!
training=Trening
yourPuzzleRatingX=Tvoj rejting u problemima: %s

View file

@ -44,7 +44,7 @@ object RatingFest {
BSONDocument("$unset" -> BSONDocument(
List(
"standard", "chess960", "kingOfTheHill",
"bullet", "blitz", "slow", "pools"
"bullet", "blitz", "classical", "pools"
).map { name => s"perfs.$name" -> BSONBoolean(true) }
)),
multi = true)

@ -1 +1 @@
Subproject commit 8a9de63878c960c3bb351e5eeec42631ddb6f7b4
Subproject commit 1ceba9320d94c506b513b735d8c6f8852563a591

View file

@ -8,7 +8,7 @@ case class History(
kingOfTheHill: RatingsMap,
bullet: RatingsMap,
blitz: RatingsMap,
slow: RatingsMap,
classical: RatingsMap,
puzzle: RatingsMap,
pools: Map[String, RatingsMap])
@ -35,7 +35,7 @@ object History {
kingOfTheHill = ratingsMap("kingOfTheHill"),
bullet = ratingsMap("bullet"),
blitz = ratingsMap("blitz"),
slow = ratingsMap("slow"),
classical = ratingsMap("classical"),
puzzle = ratingsMap("puzzle"),
pools = doc.getAs[Map[String, RatingsMap]]("pools") | Map.empty)
}

View file

@ -13,7 +13,7 @@ final class HistoryApi(coll: Coll) {
import History.BSONReader
private val slowSpeeds: Set[Speed] = Set(Speed.Slow, Speed.Unlimited)
private val classicalSpeeds: Set[Speed] = Set(Speed.Classical, Speed.Unlimited)
def add(user: User, game: Game, perfs: Perfs): Funit = {
val isStd = game.variant.standard
@ -23,7 +23,7 @@ final class HistoryApi(coll: Coll) {
game.variant.kingOfTheHill.option("kingOfTheHill" -> perfs.kingOfTheHill),
(isStd && game.speed == Speed.Bullet).option("bullet" -> perfs.bullet),
(isStd && game.speed == Speed.Blitz).option("blitz" -> perfs.blitz),
(isStd && slowSpeeds(game.speed)).option("slow" -> perfs.slow),
(isStd && classicalSpeeds(game.speed)).option("classical" -> perfs.classical),
game.poolId.map(p => s"pools.$p" -> perfs.pool(p))
).flatten.map {
case (k, p) => k -> p.intRating

View file

@ -47,8 +47,8 @@ final class RatingChartApi(historyApi: HistoryApi, cacheTtl: Duration) {
ratingsMapToJson("kingOfTheHill", history.kingOfTheHill),
ratingsMapToJson("bullet", history.bullet),
ratingsMapToJson("blitz", history.blitz),
ratingsMapToJson("slow", history.slow),
ratingsMapToJson("puzzle", history.slow)
ratingsMapToJson("classical", history.classical),
ratingsMapToJson("puzzle", history.puzzle)
).flatten)
}
}

File diff suppressed because one or more lines are too long

View file

@ -37,8 +37,8 @@ final class PerfsUpdater(historyApi: HistoryApi) {
updateRatings(ratingsW.bullet, ratingsB.bullet, result, system)
case chess.Speed.Blitz =>
updateRatings(ratingsW.blitz, ratingsB.blitz, result, system)
case chess.Speed.Slow | chess.Speed.Unlimited =>
updateRatings(ratingsW.slow, ratingsB.slow, result, system)
case chess.Speed.Classical | chess.Speed.Unlimited =>
updateRatings(ratingsW.classical, ratingsB.classical, result, system)
}
}
(ratingsW.pool |@| ratingsB.pool) apply {
@ -68,7 +68,7 @@ final class PerfsUpdater(historyApi: HistoryApi) {
kingOfTheHill: Rating,
bullet: Rating,
blitz: Rating,
slow: Rating,
classical: Rating,
pool: Option[(String, Rating)])
private def mkRatings(perfs: Perfs, poolId: Option[String]) = new Ratings(
@ -77,7 +77,7 @@ final class PerfsUpdater(historyApi: HistoryApi) {
kingOfTheHill = perfs.kingOfTheHill.toRating,
bullet = perfs.bullet.toRating,
blitz = perfs.blitz.toRating,
slow = perfs.slow.toRating,
classical = perfs.classical.toRating,
pool = poolId map (id => id -> perfs.pool(id).toRating))
private def resultOf(game: Game): Glicko.Result =
@ -102,7 +102,7 @@ final class PerfsUpdater(historyApi: HistoryApi) {
}
}
private val slowSpeeds: Set[Speed] = Set(Speed.Slow, Speed.Unlimited)
private val classicalSpeeds: Set[Speed] = Set(Speed.Classical, Speed.Unlimited)
private def mkPerfs(ratings: Ratings, perfs: Perfs, game: Game): Perfs = {
val speed = game.speed
@ -113,7 +113,7 @@ final class PerfsUpdater(historyApi: HistoryApi) {
kingOfTheHill = game.variant.kingOfTheHill.fold(perfs.kingOfTheHill add ratings.kingOfTheHill, perfs.kingOfTheHill),
bullet = (isStd && speed == Speed.Bullet).fold(perfs.bullet add ratings.bullet, perfs.bullet),
blitz = (isStd && speed == Speed.Blitz).fold(perfs.blitz add ratings.blitz, perfs.blitz),
slow = (isStd && slowSpeeds(speed)).fold(perfs.slow add ratings.slow, perfs.slow))
classical = (isStd && classicalSpeeds(speed)).fold(perfs.classical add ratings.classical, perfs.classical))
ratings.pool.fold(perfs1) {
case (id, poolRating) => perfs1.copy(
pools = perfs1.pools + (id -> perfs.pool(id).add(poolRating))

View file

@ -32,30 +32,30 @@ object Schedule {
object Speed {
case object Bullet extends Speed
case object Blitz extends Speed
case object Slow extends Speed
val all: List[Speed] = List(Bullet, Blitz, Slow)
case object Classical extends Speed
val all: List[Speed] = List(Bullet, Blitz, Classical)
def apply(name: String) = all find (_.name == name)
}
private[tournament] def durationFor(sched: Schedule): Option[Int] = Some((sched.freq, sched.speed) match {
case (Freq.Hourly, Speed.Bullet) => 30
case (Freq.Hourly, Speed.Blitz) => 50
case (Freq.Hourly, Speed.Slow) => 0 // N/A
case (Freq.Daily, Speed.Bullet) => 45
case (Freq.Daily, Speed.Blitz) => 80
case (Freq.Daily, Speed.Slow) => 120
case (Freq.Weekly, Speed.Bullet) => 50
case (Freq.Weekly, Speed.Blitz) => 90
case (Freq.Weekly, Speed.Slow) => 120
case (Freq.Monthly, Speed.Bullet) => 60
case (Freq.Monthly, Speed.Blitz) => 100
case (Freq.Monthly, Speed.Slow) => 150
case (Freq.Hourly, Speed.Bullet) => 30
case (Freq.Hourly, Speed.Blitz) => 50
case (Freq.Hourly, Speed.Classical) => 0 // N/A
case (Freq.Daily, Speed.Bullet) => 45
case (Freq.Daily, Speed.Blitz) => 80
case (Freq.Daily, Speed.Classical) => 120
case (Freq.Weekly, Speed.Bullet) => 50
case (Freq.Weekly, Speed.Blitz) => 90
case (Freq.Weekly, Speed.Classical) => 120
case (Freq.Monthly, Speed.Bullet) => 60
case (Freq.Monthly, Speed.Blitz) => 100
case (Freq.Monthly, Speed.Classical) => 150
}) filter (0!=)
private[tournament] def clockFor(sched: Schedule) = sched.speed match {
case Schedule.Speed.Bullet => TournamentClock(60, 0)
case Schedule.Speed.Blitz => TournamentClock(5 * 60, 0)
case Schedule.Speed.Slow => TournamentClock(10 * 60, 0)
case Schedule.Speed.Bullet => TournamentClock(60, 0)
case Schedule.Speed.Blitz => TournamentClock(5 * 60, 0)
case Schedule.Speed.Classical => TournamentClock(10 * 60, 0)
}
import lila.db.JsTube
@ -81,5 +81,5 @@ object Schedule {
Writes[Speed](speed => JsString(speed.name)))
private[tournament] val tube = JsTube(
(__.json update readDate('at)) andThen Json.reads[Schedule],
Json.writes[Schedule] andThen (__.json update writeDate('at)))
Json.writes[Schedule] andThen (__.json update writeDate('at)))
}

View file

@ -26,13 +26,13 @@ private[tournament] final class Scheduler(api: TournamentApi) extends Actor {
val scheds = List(
Schedule(Monthly, Bullet, at(lastFridayOfCurrentMonth, 17)),
Schedule(Monthly, Blitz, at(lastFridayOfCurrentMonth, 18, 20)),
Schedule(Monthly, Slow, at(lastFridayOfCurrentMonth, 20, 30)),
Schedule(Monthly, Classical, at(lastFridayOfCurrentMonth, 20, 30)),
Schedule(Weekly, Bullet, at(nextFriday, 17)),
Schedule(Weekly, Blitz, at(nextFriday, 18)),
Schedule(Weekly, Slow, at(nextFriday, 20)),
Schedule(Weekly, Classical, at(nextFriday, 20)),
Schedule(Daily, Bullet, at(today, 17)),
Schedule(Daily, Blitz, at(today, 18)),
Schedule(Daily, Slow, at(today, 20)),
Schedule(Daily, Classical, at(today, 20)),
Schedule(Hourly, Bullet, at(nextHourDate, nextHour)),
Schedule(Hourly, Blitz, at(nextHourDate, nextHour, 30))
).foldLeft(List[Schedule]()) {

View file

@ -30,7 +30,7 @@ final class Cached(
val topRating = AsyncCache(UserRepo.topRating, timeToLive = 30 minutes)
val topBullet = AsyncCache(UserRepo.topBullet, timeToLive = 31 minutes)
val topBlitz = AsyncCache(UserRepo.topBlitz, timeToLive = 32 minutes)
val topSlow = AsyncCache(UserRepo.topSlow, timeToLive = 33 minutes)
val topClassical = AsyncCache(UserRepo.topClassical, timeToLive = 33 minutes)
val topNbGame = AsyncCache(UserRepo.topNbGame, timeToLive = 34 minutes)
val topPool = AsyncCache(

View file

@ -12,7 +12,7 @@ case class Perfs(
kingOfTheHill: Perf,
bullet: Perf,
blitz: Perf,
slow: Perf,
classical: Perf,
puzzle: Perf,
pools: Map[String, Perf]) {
@ -22,7 +22,7 @@ case class Perfs(
"kingOfTheHill" -> kingOfTheHill,
"bullet" -> bullet,
"blitz" -> blitz,
"slow" -> slow,
"classical" -> classical,
"puzzle" -> puzzle) ::: pools.toList.map {
case (id, perf) => s"$id pool" -> perf
}
@ -46,7 +46,7 @@ case object Perfs {
val names = Map(
"bullet" -> "Bullet",
"blitz" -> "Blitz",
"slow" -> "Classical",
"classical" -> "Classical",
"standard" -> "Standard",
"chess960" -> "Chess960",
"kingOfTheHill" -> "King Of The Hill",
@ -55,7 +55,7 @@ case object Perfs {
val titles = Map(
"bullet" -> "Very fast games: less than 3 minutes",
"blitz" -> "Fast games: less than 8 minutes",
"slow" -> "Slow games: more than 8 minutes",
"classical" -> "Classical games: more than 8 minutes",
"standard" -> "Standard rules of chess",
"chess960" -> "Chess960 variant",
"kingOfTheHill" -> "King Of The Hill variant",
@ -71,7 +71,7 @@ case object Perfs {
def speedLens(speed: Speed): Perfs => Perf = speed match {
case Speed.Bullet => perfs => perfs.bullet
case Speed.Blitz => perfs => perfs.blitz
case Speed.Slow | Speed.Unlimited => perfs => perfs.slow
case Speed.Classical | Speed.Unlimited => perfs => perfs.classical
}
def poolLens(poolId: Option[String]): Perfs => Option[Perf] =
@ -90,7 +90,7 @@ case object Perfs {
kingOfTheHill = perf("kingOfTheHill"),
bullet = perf("bullet"),
blitz = perf("blitz"),
slow = perf("slow"),
classical = perf("classical"),
puzzle = perf("puzzle"),
pools = r.getO[Map[String, Perf]]("pools") getOrElse Map.empty)
}
@ -103,7 +103,7 @@ case object Perfs {
"kingOfTheHill" -> notNew(o.kingOfTheHill),
"bullet" -> notNew(o.bullet),
"blitz" -> notNew(o.blitz),
"slow" -> notNew(o.slow),
"classical" -> notNew(o.classical),
"puzzle" -> notNew(o.puzzle),
"pools" -> o.pools.flatMap {
case (k, r) => notNew(r) map (k -> _)

View file

@ -36,7 +36,7 @@ trait UserRepo {
def topBullet = topPerf("bullet") _
def topBlitz = topPerf("blitz") _
def topSlow = topPerf("slow") _
def topClassical = topPerf("classical") _
def topPerf(perf: String)(nb: Int): Fu[List[User]] =
$find($query(stableGoodLadSelect) sort ($sort desc s"perfs.$perf.gl.r"), nb)
@ -105,7 +105,7 @@ trait UserRepo {
"kingOfTheHill" -> (_.kingOfTheHill),
"bullet" -> (_.bullet),
"blitz" -> (_.blitz),
"slow" -> (_.slow),
"classical" -> (_.classical),
"puzzle" -> (_.puzzle))
val poolLenses: PerfLenses = perfs.pools.keys.toList.map { k =>
s"pools.$k" -> ((ps: Perfs) => ps pool k)