From 400685ea1375ff345d1399676019533596f98c70 Mon Sep 17 00:00:00 2001 From: Thibault Duplessis Date: Wed, 2 Jan 2013 05:13:10 +0100 Subject: [PATCH] Revert "Add elo diff to lobby filters WIP" This reverts commit e0e4b33414dbdd0ab8c7c0801d0e18490759e94e. --- app/setup/FilterConfig.scala | 29 ++++++++++------------------- app/setup/FormFactory.scala | 3 +-- app/setup/Mappings.scala | 1 - todo | 1 - 4 files changed, 11 insertions(+), 23 deletions(-) diff --git a/app/setup/FilterConfig.scala b/app/setup/FilterConfig.scala index c3e65feabe..c808887f1f 100644 --- a/app/setup/FilterConfig.scala +++ b/app/setup/FilterConfig.scala @@ -6,30 +6,26 @@ import chess.{ Variant, Mode, Speed } case class FilterConfig( variant: Option[Variant], mode: Option[Mode], - speed: Option[Speed], - eloDiff: Int) { + speed: Option[Speed]) { def withModeCasual = copy(mode = Mode.Casual.some) def encode = RawFilterConfig( v = ~variant.map(_.id), m = mode.map(_.id) | -1, - s = ~speed.map(_.id), - e = eloDiff + s = ~speed.map(_.id) ) def >> = ( variant map (_.id), mode map (_.id), - speed map (_.id), - eloDiff + speed map (_.id) ).some def render = Map( "variant" -> variant.map(_.toString), "mode" -> mode.map(_.toString), - "speed" -> speed.map(_.id), - "eloDiff" -> eloDiff + "speed" -> speed.map(_.id) ) } @@ -38,19 +34,16 @@ object FilterConfig { val default = FilterConfig( variant = none, mode = none, - speed = none, - eloDiff = 0) + speed = none) val variants = 0 :: Config.variants val modes = -1 :: Mode.all.map(_.id) val speeds = 0 :: Config.speeds - val eloDiffs = 0 :: 100 :: 200 :: 300 :: 500 :: Nil - def <<(v: Option[Int], m: Option[Int], s: Option[Int], e: Int) = new FilterConfig( + def <<(v: Option[Int], m: Option[Int], s: Option[Int]) = new FilterConfig( variant = v flatMap Variant.apply, mode = m flatMap Mode.apply, - speed = s flatMap Speed.apply, - eloDiff = e + speed = s flatMap Speed.apply ) import com.mongodb.casbah.Imports._ @@ -60,17 +53,15 @@ object FilterConfig { variant ← filter.getAs[Int]("v") mode ← filter.getAs[Int]("m") speed ← filter.getAs[Int]("s") - eloDiff = ~filter.getAs[Int]("e") - config ← RawFilterConfig(variant, mode, speed, eloDiff).decode + config ← RawFilterConfig(variant, mode, speed).decode } yield config } -private[setup] case class RawFilterConfig(v: Int, m: Int, s: Int, e: Int) { +private[setup] case class RawFilterConfig(v: Int, m: Int, s: Int) { def decode = FilterConfig( variant = Variant(v), mode = Mode(m), - speed = Speed(s), - eloDiff = e + speed = Speed(s) ).some } diff --git a/app/setup/FormFactory.scala b/app/setup/FormFactory.scala index 5a06d3b2a3..6c9f3c54f8 100644 --- a/app/setup/FormFactory.scala +++ b/app/setup/FormFactory.scala @@ -21,8 +21,7 @@ private[setup] final class FormFactory( mapping( "variant" -> optional(variant), "mode" -> mode(ctx.isAuth), - "speed" -> optional(speed), - "eloDiff" -> eloDiff + "speed" -> optional(speed) )(FilterConfig.<<)(_.>>) ) diff --git a/app/setup/Mappings.scala b/app/setup/Mappings.scala index ad7d396559..6970b7cf2d 100644 --- a/app/setup/Mappings.scala +++ b/app/setup/Mappings.scala @@ -19,5 +19,4 @@ object Mappings { val color = nonEmptyText.verifying(Color.names contains _) val level = number.verifying(AiConfig.levels contains _) val speed = number.verifying(Config.speeds contains _) - val eloDiff = number.verifying(FilterConfig.eloDiffs contains _) } diff --git a/todo b/todo index f3c4794d39..03a677f164 100644 --- a/todo +++ b/todo @@ -53,4 +53,3 @@ make signup more visible traduction intégrale block user creation from an IP mute IP -fast join game = creator not redirected properly?