filter exported games by perf type

This commit is contained in:
Thibault Duplessis 2018-04-21 19:51:34 +02:00
parent 7289b53eca
commit 524e384839
2 changed files with 5 additions and 1 deletions

View file

@ -44,6 +44,7 @@ object Game extends LilaController {
until = getLong("until", req) map { ts => new DateTime(ts) },
max = getInt("max", req) map (_ atLeast 1),
rated = getBoolOpt("rated", req),
perfType = get("perfType", req) flatMap lila.rating.PerfType.apply,
flags = lila.game.PgnDump.WithFlags(
moves = getBoolOpt("moves", req) | true,
tags = getBoolOpt("tags", req) | true,

View file

@ -63,9 +63,12 @@ object PgnDump {
until: Option[DateTime] = None,
max: Option[Int] = None,
rated: Option[Boolean] = None,
perfType: Option[lila.rating.PerfType],
flags: WithFlags,
perSecond: MaxPerSecond
) {
def postFilter(g: Game) = rated.fold(true)(g.rated ==)
def postFilter(g: Game) =
rated.fold(true)(g.rated ==) &&
perfType.fold(true)(g.perfType.has)
}
}