diff --git a/modules/recap/src/main/Recap.scala b/modules/recap/src/main/Recap.scala index bd889077d5de..9674b3bea5d0 100644 --- a/modules/recap/src/main/Recap.scala +++ b/modules/recap/src/main/Recap.scala @@ -29,17 +29,14 @@ case class RecapGames( sources: Map[Source, Int], opponents: List[Counted[UserId]], perfs: List[Recap.Perf] -): - def significantPerfs: List[Recap.Perf] = perfs.filter: p => - (p.games > (nbs.total / 20)) || (p.seconds > (timePlaying.toSeconds / 20)) +) case class RecapPuzzles(nbs: NbWin = NbWin(), votes: PuzzleVotes = PuzzleVotes()) object Recap: case class Counted[A](value: A, count: Int) - case class Perf(key: PerfKey, seconds: Int, games: Int): - def duration = seconds.seconds + case class Perf(key: PerfKey, games: Int) type Openings = ByColor[Counted[SimpleOpening]] lazy val nopening = Counted(SimpleOpening.openingList.head, 0) diff --git a/modules/recap/src/main/RecapBuilder.scala b/modules/recap/src/main/RecapBuilder.scala index 5c05703ca250..d24c878fd978 100644 --- a/modules/recap/src/main/RecapBuilder.scala +++ b/modules/recap/src/main/RecapBuilder.scala @@ -69,9 +69,9 @@ private final class RecapBuilder( sources = scan.sources, opponents = scan.opponents.toList.sortBy(-_._2).take(5).map(Recap.Counted.apply), perfs = scan.perfs.toList - .sortBy(-_._2._1) + .sortBy(-_._2) .map: - case (key, (seconds, games)) => Recap.Perf(key, seconds, games) + case (key, games) => Recap.Perf(key, games) ) private def runGameScan(userId: UserId): Fu[GameScan] = @@ -96,7 +96,7 @@ private final class RecapBuilder( firstMoves: Map[SanStr, Int] = Map.empty, sources: Map[Source, Int] = Map.empty, opponents: Map[UserId, Int] = Map.empty, - perfs: Map[PerfKey, (Int, Int)] = Map.empty + perfs: Map[PerfKey, Int] = Map.empty ): def addGame(userId: UserId)(g: Game): GameScan = g.player(userId) @@ -125,6 +125,5 @@ private final class RecapBuilder( opponents = opponent.fold(opponents): op => opponents.updatedWith(op)(_.fold(1)(_ + 1).some), perfs = perfs.updatedWith(g.perfKey): pk => - pk.fold((durationSeconds, 1).some): (seconds, games) => - (seconds + durationSeconds, games + 1).some + some(pk.orZero + 1) ) diff --git a/ui/recap/src/interfaces.ts b/ui/recap/src/interfaces.ts index 0f0cb1ae3c32..791d901d37cd 100644 --- a/ui/recap/src/interfaces.ts +++ b/ui/recap/src/interfaces.ts @@ -32,7 +32,6 @@ export interface Sources { export interface RecapPerf { key: Exclude; - seconds: number; games: number; }