remove Activity.tours; tournament_leaderboard already aggregates
This commit is contained in:
parent
109c8c8407
commit
a0e003ca6e
|
@ -9,7 +9,6 @@ import lila.user.User
|
|||
case class Activity(
|
||||
id: Activity.Id,
|
||||
games: Activity.Games,
|
||||
tours: Activity.Tours,
|
||||
comps: Activity.CompAnalysis,
|
||||
posts: Activity.Posts
|
||||
) {
|
||||
|
@ -50,13 +49,6 @@ object Activity {
|
|||
implicit val RatingDiffZero = Zero.instance(RatingDiff(0))
|
||||
implicit val ScoreZero = Zero.instance(Score(0, 0, 0, RatingDiffZero.zero))
|
||||
|
||||
case class Tours(value: Map[Tours.TourId, Tours.Result]) extends AnyVal
|
||||
object Tours {
|
||||
case class TourId(value: String) extends AnyVal
|
||||
case class Result(rank: Int, points: Int, score: Score)
|
||||
}
|
||||
implicit val ToursZero = Zero.instance(Tours(Map.empty))
|
||||
|
||||
case class Posts(posts: Map[Posts.TopicId, List[Posts.PostId]]) {
|
||||
def total = posts.foldLeft(0)(_ + _._2.size)
|
||||
def +(postId: Posts.PostId, topicId: Posts.TopicId) = Posts {
|
||||
|
@ -78,7 +70,6 @@ object Activity {
|
|||
def make(userId: User.ID) = Activity(
|
||||
id = Id today userId,
|
||||
games = GamesZero.zero,
|
||||
tours = ToursZero.zero,
|
||||
posts = PostsZero.zero,
|
||||
comps = CompsZero.zero
|
||||
)
|
||||
|
|
|
@ -49,14 +49,6 @@ private object BSONHandlers {
|
|||
private implicit val gamesMapHandler = MapDocument.MapHandler[PerfType, Score]
|
||||
private implicit val gamesHandler = isoHandler[Games, Map[PerfType, Score], Bdoc]((g: Games) => g.value, Games.apply _)
|
||||
|
||||
private implicit val tourIdIso = Iso.string[Tours.TourId](Tours.TourId.apply, _.value)
|
||||
private implicit val tourResultHandler = {
|
||||
import Tours.Result
|
||||
Macros.handler[Result]
|
||||
}
|
||||
private implicit val toursMapHandler = MapDocument.MapHandler[Tours.TourId, Tours.Result]
|
||||
private implicit val toursHandler = isoHandler[Tours, Map[Tours.TourId, Tours.Result], Bdoc]((t: Tours) => t.value, Tours.apply _)
|
||||
|
||||
private implicit val gameIdHandler = stringAnyValHandler[GameId](_.value, GameId.apply)
|
||||
private implicit val gameIdsHandler = bsonArrayToListHandler[GameId]
|
||||
private implicit val compAnalysisHandler = isoHandler[CompAnalysis, List[GameId], Barr]((c: CompAnalysis) => c.gameIds, CompAnalysis.apply _)
|
||||
|
@ -71,14 +63,12 @@ private object BSONHandlers {
|
|||
|
||||
private val id = "_id"
|
||||
private val games = "g"
|
||||
private val tours = "t"
|
||||
private val comps = "c"
|
||||
private val posts = "p"
|
||||
|
||||
def reads(r: lila.db.BSON.Reader) = Activity(
|
||||
id = r.get[Id](id),
|
||||
games = r.getD[Games](games),
|
||||
tours = r.getD[Tours](tours),
|
||||
comps = r.getD[CompAnalysis](comps),
|
||||
posts = r.getD[Posts](posts)
|
||||
)
|
||||
|
@ -86,7 +76,6 @@ private object BSONHandlers {
|
|||
def writes(w: lila.db.BSON.Writer, o: Activity) = BSONDocument(
|
||||
id -> o.id,
|
||||
games -> w.zero(o.games),
|
||||
tours -> w.zero(o.tours),
|
||||
comps -> w.zero(o.comps),
|
||||
posts -> w.zero(o.posts)
|
||||
)
|
||||
|
|
|
@ -193,7 +193,7 @@ object ApplicationBuild extends Build {
|
|||
libraryDependencies ++= provided(play.api, reactivemongo.driver)
|
||||
)
|
||||
|
||||
lazy val activity = project("activity", Seq(common, game, analyse, user, forum, study, pool, puzzle)).settings(
|
||||
lazy val activity = project("activity", Seq(common, game, analyse, user, forum, study, pool, puzzle, tournament)).settings(
|
||||
libraryDependencies ++= provided(play.api, reactivemongo.driver)
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in a new issue