parent
e381b9bb21
commit
b821d8fea4
|
@ -27,11 +27,8 @@ final class PgnDump(
|
|||
}
|
||||
}
|
||||
|
||||
def exportUserGames(userId: String): Enumerator[String] = {
|
||||
import reactivemongo.play.iteratees.cursorProducer
|
||||
GameRepo.sortedCursor(Query user userId, Query.sortCreated).
|
||||
enumerator() &> toPgn
|
||||
}
|
||||
def exportUserGames(userId: String): Enumerator[String] =
|
||||
GameRepo.sortedCursor(Query user userId, Query.sortCreated).enumerate() &> toPgn
|
||||
|
||||
def exportGamesFromIds(ids: List[String]): Enumerator[String] =
|
||||
Enumerator.enumerate(ids grouped 50) &>
|
||||
|
|
|
@ -20,22 +20,20 @@ private[blog] final class Notifier(
|
|||
}
|
||||
|
||||
private def doSend(post: Document): Funit = {
|
||||
import reactivemongo.play.iteratees.cursorProducer
|
||||
|
||||
val content = NewBlogPost(
|
||||
id = NewBlogPost.Id(post.id),
|
||||
slug = NewBlogPost.Slug(post.slug),
|
||||
title = NewBlogPost.Title(~post.getText("blog.title")))
|
||||
UserRepo.recentlySeenNotKidIdsCursor(DateTime.now minusWeeks 1)
|
||||
.enumerator(500 * 1000) &> Enumeratee.map {
|
||||
_.getAs[String]("_id") err "User without an id"
|
||||
} |>>>
|
||||
Iteratee.foldM[String, Int](0) {
|
||||
case (count, userId) => notifyApi.addNotificationWithoutSkipOrEvent(
|
||||
.enumerate(500 * 1000) &> Enumeratee.map {
|
||||
_.getAs[String]("_id") err "User without an id"
|
||||
} |>>>
|
||||
Iteratee.foldM[String, Int](0) {
|
||||
case (count, userId) => notifyApi.addNotificationWithoutSkipOrEvent(
|
||||
Notification.make(Notification.Notifies(userId), content)
|
||||
) inject (count + 1)
|
||||
} addEffect { count =>
|
||||
logger.info(s"Sent $count notifications")
|
||||
} void
|
||||
) inject (count + 1)
|
||||
} addEffect { count =>
|
||||
logger.info(s"Sent $count notifications")
|
||||
} void
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ object BSON extends Handlers {
|
|||
val b = collection.immutable.Map.newBuilder[String, V]
|
||||
for (tuple <- bson.elements)
|
||||
// assume that all values in the document are Bdocs
|
||||
b += (tuple.name -> vr.read(tuple.value.asInstanceOf[Bdoc]))
|
||||
b += (tuple._1 -> vr.read(tuple._2.asInstanceOf[Bdoc]))
|
||||
b.result
|
||||
}
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ object BSON extends Handlers {
|
|||
val valueReader = vr.asInstanceOf[BSONReader[BSONValue, V]]
|
||||
// mutable optimized implementation
|
||||
val b = collection.immutable.Map.newBuilder[String, V]
|
||||
for (tuple <- bson.elements) b += (tuple.name -> valueReader.read(tuple.value))
|
||||
for (tuple <- bson.elements) b += (tuple._1 -> valueReader.read(tuple._2))
|
||||
b.result
|
||||
}
|
||||
}
|
||||
|
@ -108,7 +108,7 @@ object BSON extends Handlers {
|
|||
val map = {
|
||||
// mutable optimized implementation
|
||||
val b = collection.immutable.Map.newBuilder[String, BSONValue]
|
||||
for (tuple <- doc.stream if tuple.isSuccess) b += (tuple.get.name -> tuple.get.value)
|
||||
for (tuple <- doc.stream if tuple.isSuccess) b += (tuple.get._1 -> tuple.get._2)
|
||||
b.result
|
||||
}
|
||||
|
||||
|
@ -194,7 +194,7 @@ object BSON extends Handlers {
|
|||
}
|
||||
def debugArr(doc: Barr): String = doc.values.toList.map(debug).mkString("[", ", ", "]")
|
||||
def debugDoc(doc: Bdoc): String = (doc.elements.toList map {
|
||||
case BSONElement(k, v) => s"$k: ${debug(v)}"
|
||||
case (k, v) => s"$k: ${debug(v)}"
|
||||
}).mkString("{", ", ", "}")
|
||||
|
||||
def hashDoc(doc: Bdoc): String = debugDoc(doc).replace(" ", "")
|
||||
|
|
|
@ -13,7 +13,7 @@ final class Env(
|
|||
lifecycle: play.api.inject.ApplicationLifecycle) {
|
||||
|
||||
lazy val (connection, dbName) = {
|
||||
val driver = MongoDriver(config)
|
||||
val driver = new MongoDriver(Some(config))
|
||||
|
||||
registerDriverShutdownHook(driver)
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ import reactivemongo.api._
|
|||
import reactivemongo.api.collections.GenericQueryBuilder
|
||||
import reactivemongo.bson._
|
||||
|
||||
trait dsl extends LowPriorityDsl {
|
||||
trait dsl {
|
||||
|
||||
type Coll = reactivemongo.api.collections.bson.BSONCollection
|
||||
type Bdoc = BSONDocument
|
||||
|
@ -116,8 +116,7 @@ trait dsl extends LowPriorityDsl {
|
|||
}
|
||||
|
||||
def $rename(item: (String, String), items: (String, String)*)(implicit writer: BSONWriter[String, _ <: BSONValue]): BSONDocument = {
|
||||
$doc("$rename" -> $doc((item +: items).
|
||||
map { case (k, v) => BSONElement(k, BSONString(v)) }))
|
||||
$doc("$rename" -> $doc((Seq(item) ++ items).map(Producer.nameValue2Producer[String]): _*))
|
||||
}
|
||||
|
||||
def $setOnInsert(item: Producer[BSONElement], items: Producer[BSONElement]*): BSONDocument = {
|
||||
|
@ -129,7 +128,7 @@ trait dsl extends LowPriorityDsl {
|
|||
}
|
||||
|
||||
def $unset(field: String, fields: String*): BSONDocument = {
|
||||
$doc("$unset" -> $doc((Seq(field) ++ fields).map(k => BSONElement(k, BSONString("")))))
|
||||
$doc("$unset" -> $doc((Seq(field) ++ fields).map(_ -> BSONString(""))))
|
||||
}
|
||||
|
||||
def $min(item: Producer[BSONElement]): BSONDocument = {
|
||||
|
@ -185,7 +184,7 @@ trait dsl extends LowPriorityDsl {
|
|||
}
|
||||
|
||||
def $currentDate(items: (String, CurrentDateValueProducer[_])*): BSONDocument = {
|
||||
$doc("$currentDate" -> $doc(items.map(item => BSONElement(item._1, item._2.produce))))
|
||||
$doc("$currentDate" -> $doc(items.map(item => item._1 -> item._2.produce)))
|
||||
}
|
||||
// End of Top Level Field Update Operators
|
||||
//**********************************************************************************************//
|
||||
|
@ -372,16 +371,13 @@ trait dsl extends LowPriorityDsl {
|
|||
with LogicalOperators
|
||||
with ArrayOperators
|
||||
|
||||
implicit def toBSONElement[V <: BSONValue](expression: Expression[V])(implicit writer: BSONWriter[V, _ <: BSONValue]): Producer[BSONElement] = {
|
||||
expression.field -> expression.value
|
||||
}
|
||||
|
||||
implicit def toBSONDocument[V <: BSONValue](expression: Expression[V])(implicit writer: BSONWriter[V, _ <: BSONValue]): BSONDocument =
|
||||
$doc(expression.field -> expression.value)
|
||||
|
||||
}
|
||||
|
||||
sealed trait LowPriorityDsl { self: dsl =>
|
||||
// Priority lower than toBSONDocument
|
||||
implicit def toBSONElement[V <: BSONValue](expression: Expression[V])(implicit writer: BSONWriter[V, _ <: BSONValue]): Producer[BSONElement] = {
|
||||
BSONElement(expression.field, expression.value)
|
||||
}
|
||||
}
|
||||
|
||||
object dsl extends dsl with CollExt with QueryBuilderExt with CursorExt with Handlers
|
||||
|
|
|
@ -56,12 +56,10 @@ case class Assessible(analysed: Analysed) {
|
|||
case PlayerFlags(T, T, T, T, T, T, T) => Cheating // all T, obvious cheat
|
||||
case PlayerFlags(T, _, T, _, _, T, _) => Cheating // high accuracy, high blurs, no fast moves
|
||||
case PlayerFlags(T, _, _, T, _, _, _) => Cheating // high accuracy, moderate blurs
|
||||
|
||||
case PlayerFlags(_, T, _, T, T, _, _) => LikelyCheating // always has advantage, moderate blurs, highly consistent move times
|
||||
|
||||
case PlayerFlags(_, _, _, T, T, _, _) => LikelyCheating // high accuracy, moderate blurs => 93% chance cheating
|
||||
case PlayerFlags(T, _, _, _, _, _, T) => LikelyCheating // Holds are bad, hmk?
|
||||
case PlayerFlags(_, T, _, _, _, _, T) => LikelyCheating // Holds are bad, hmk?
|
||||
|
||||
case PlayerFlags(T, _, _, _, _, _, T) => LikelyCheating // Holds are bad, hmk?
|
||||
case PlayerFlags(_, T, _, _, _, _, T) => LikelyCheating // Holds are bad, hmk?
|
||||
case PlayerFlags(_, T, T, _, _, _, _) => LikelyCheating // always has advantage, high blurs
|
||||
|
||||
case PlayerFlags(_, T, _, _, T, T, _) => Unclear // always has advantage, consistent move times
|
||||
|
|
|
@ -44,14 +44,11 @@ private final class ExplorerIndexer(
|
|||
Query.turnsMoreThan(8) ++
|
||||
Query.noProvisional ++
|
||||
Query.bothRatingsGreaterThan(1501)
|
||||
|
||||
import reactivemongo.api._
|
||||
import reactivemongo.play.iteratees.cursorProducer
|
||||
|
||||
gameColl.find(query)
|
||||
.sort(Query.sortChronological)
|
||||
.cursor[Game](ReadPreference.secondary)
|
||||
.enumerator(maxGames) &>
|
||||
.enumerate(maxGames, stopOnError = true) &>
|
||||
Enumeratee.mapM[Game].apply[Option[GamePGN]] { game =>
|
||||
makeFastPgn(game) map {
|
||||
_ map { game -> _ }
|
||||
|
|
|
@ -3,7 +3,7 @@ package lila.forum
|
|||
import lila.db.dsl._
|
||||
import lila.user.User.BSONFields
|
||||
import org.joda.time.DateTime
|
||||
import reactivemongo.api.{ CursorProducer, ReadPreference }
|
||||
import reactivemongo.api.ReadPreference
|
||||
|
||||
object PostRepo extends PostRepo(false) {
|
||||
|
||||
|
@ -77,7 +77,6 @@ sealed abstract class PostRepo(troll: Boolean) {
|
|||
|
||||
def cursor(
|
||||
selector: Bdoc,
|
||||
readPreference: ReadPreference = ReadPreference.secondaryPreferred)(
|
||||
implicit cp: CursorProducer[Post]) =
|
||||
readPreference: ReadPreference = ReadPreference.secondaryPreferred) =
|
||||
coll.find(selector).cursor[Post](readPreference)
|
||||
}
|
||||
|
|
|
@ -33,8 +33,6 @@ final class ForumSearchApi(
|
|||
Fields.troll -> view.post.troll,
|
||||
Fields.date -> view.post.createdAt.getDate)
|
||||
|
||||
import reactivemongo.play.iteratees.cursorProducer
|
||||
|
||||
def reset = client match {
|
||||
case c: ESClientHttp => c.putMapping >> {
|
||||
import play.api.libs.iteratee._
|
||||
|
@ -46,7 +44,7 @@ final class ForumSearchApi(
|
|||
PostRepo.cursor(
|
||||
selector = $empty,
|
||||
readPreference = ReadPreference.secondaryPreferred)
|
||||
.enumerator(maxEntries) &>
|
||||
.enumerate(maxEntries, stopOnError = true) &>
|
||||
Enumeratee.grouped(Iteratee takeUpTo batchSize) |>>>
|
||||
Iteratee.foldM[Seq[Post], Int](0) {
|
||||
case (nb, posts) => for {
|
||||
|
|
|
@ -11,8 +11,8 @@ import lila.db.ByteArray
|
|||
|
||||
private[game] object GameDiff {
|
||||
|
||||
type Set = BSONElement // [String, BSONValue]
|
||||
type Unset = BSONElement //[String, BSONBoolean]
|
||||
type Set = (String, BSONValue)
|
||||
type Unset = (String, BSONBoolean)
|
||||
|
||||
def apply(a: Game, b: Game): (List[Set], List[Unset]) = {
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ import scala.util.Random
|
|||
import chess.format.{ Forsyth, FEN }
|
||||
import chess.{ Color, Status }
|
||||
import org.joda.time.DateTime
|
||||
import reactivemongo.api.{ CursorProducer, ReadPreference }
|
||||
import reactivemongo.api.ReadPreference
|
||||
import reactivemongo.bson.BSONBinary
|
||||
|
||||
import lila.db.BSON.BSONJodaDateTimeHandler
|
||||
|
@ -86,15 +86,13 @@ object GameRepo {
|
|||
|
||||
def cursor(
|
||||
selector: Bdoc,
|
||||
readPreference: ReadPreference = ReadPreference.secondaryPreferred)(
|
||||
implicit cp: CursorProducer[Game]) =
|
||||
readPreference: ReadPreference = ReadPreference.secondaryPreferred) =
|
||||
coll.find(selector).cursor[Game](readPreference)
|
||||
|
||||
def sortedCursor(
|
||||
selector: Bdoc,
|
||||
sort: Bdoc,
|
||||
readPreference: ReadPreference = ReadPreference.secondaryPreferred)(
|
||||
implicit cp: CursorProducer[Game]) =
|
||||
readPreference: ReadPreference = ReadPreference.secondaryPreferred) =
|
||||
coll.find(selector).sort(sort).cursor[Game](readPreference)
|
||||
|
||||
def unrate(gameId: String) =
|
||||
|
@ -364,7 +362,7 @@ object GameRepo {
|
|||
Project($doc(
|
||||
F.playerUids -> true,
|
||||
F.id -> false)),
|
||||
UnwindField(F.playerUids),
|
||||
Unwind(F.playerUids),
|
||||
Match($doc(F.playerUids -> $doc("$ne" -> userId))),
|
||||
GroupField(F.playerUids)("gs" -> SumValue(1)),
|
||||
Sort(Descending("gs")),
|
||||
|
@ -433,7 +431,7 @@ object GameRepo {
|
|||
Match,
|
||||
Sort,
|
||||
SumValue,
|
||||
UnwindField
|
||||
Unwind
|
||||
}
|
||||
|
||||
coll.aggregate(Match($doc(
|
||||
|
@ -441,7 +439,7 @@ object GameRepo {
|
|||
F.status $gte chess.Status.Mate.id,
|
||||
s"${F.playerUids}.0" $exists true
|
||||
)), List(
|
||||
UnwindField(F.playerUids),
|
||||
Unwind(F.playerUids),
|
||||
Match($doc(
|
||||
F.playerUids -> $doc("$ne" -> "")
|
||||
)),
|
||||
|
|
|
@ -100,8 +100,6 @@ final class GameSearchApi(client: ESClient) extends SearchReadApi[Game, Query] {
|
|||
import lila.db.BSON.BSONJodaDateTimeHandler
|
||||
import reactivemongo.api._
|
||||
import reactivemongo.bson._
|
||||
import reactivemongo.play.iteratees.cursorProducer
|
||||
|
||||
var nbSkipped = 0
|
||||
val batchSize = 1000
|
||||
val maxGames = Int.MaxValue
|
||||
|
@ -111,7 +109,7 @@ final class GameSearchApi(client: ESClient) extends SearchReadApi[Game, Query] {
|
|||
selector = $doc("ca" $gt since),
|
||||
sort = $doc("ca" -> 1),
|
||||
readPreference = ReadPreference.secondaryPreferred)
|
||||
.enumerator(maxGames) &>
|
||||
.enumerate(maxGames, stopOnError = true) &>
|
||||
Enumeratee.grouped(Iteratee takeUpTo batchSize) |>>>
|
||||
Enumeratee.mapM[Seq[Game]].apply[(Seq[Game], Set[String])] { games =>
|
||||
GameRepo filterAnalysed games.map(_.id) map games.->
|
||||
|
|
|
@ -46,7 +46,7 @@ object History {
|
|||
|
||||
private[history] implicit val RatingsMapReader = new BSONDocumentReader[RatingsMap] {
|
||||
def read(doc: BSONDocument): RatingsMap = doc.stream.flatMap {
|
||||
case scala.util.Success(BSONElement(k, BSONInteger(v))) => parseIntOption(k) map (_ -> v)
|
||||
case scala.util.Success((k, BSONInteger(v))) => parseIntOption(k) map (_ -> v)
|
||||
case _ => none[(Int, Int)]
|
||||
}.toList sortBy (_._1)
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ final class HistoryApi(coll: Coll) {
|
|||
coll.update(
|
||||
$id(user.id),
|
||||
$doc("$set" -> $doc(changes.map {
|
||||
case (perf, rating) => BSONElement(s"$perf.$days", $int(rating))
|
||||
case (perf, rating) => s"$perf.$days" -> $int(rating)
|
||||
})),
|
||||
upsert = true
|
||||
).void
|
||||
|
|
|
@ -40,26 +40,26 @@ private final class AggregationPipeline {
|
|||
private val sampleGames = Sample(10 * 1000)
|
||||
private val sortDate = Sort(Descending(F.date))
|
||||
private val sampleMoves = Sample(200 * 1000).some
|
||||
private val unwindMoves = UnwindField(F.moves).some
|
||||
private val unwindMoves = Unwind(F.moves).some
|
||||
private val sortNb = Sort(Descending("nb")).some
|
||||
private def limit(nb: Int) = Limit(nb).some
|
||||
private def group(d: Dimension[_], f: GroupFunction) = Group(dimensionGroupId(d))(
|
||||
"v" -> f,
|
||||
"nb" -> SumValue(1),
|
||||
"ids" -> AddFieldToSet("_id")
|
||||
"ids" -> AddToSet("_id")
|
||||
).some
|
||||
private def groupMulti(d: Dimension[_], metricDbKey: String) = Group($doc(
|
||||
"dimension" -> dimensionGroupId(d),
|
||||
"metric" -> ("$" + metricDbKey)))(
|
||||
"v" -> SumValue(1),
|
||||
"ids" -> AddFieldToSet("_id")
|
||||
"ids" -> AddToSet("_id")
|
||||
).some
|
||||
private val regroupStacked = GroupField("_id.dimension")(
|
||||
"nb" -> SumField("v"),
|
||||
"ids" -> FirstField("ids"),
|
||||
"stack" -> Push(BSONDocument(
|
||||
"ids" -> First("ids"),
|
||||
"stack" -> PushMulti(
|
||||
"metric" -> "_id.metric",
|
||||
"v" -> "v"))).some
|
||||
"v" -> "v")).some
|
||||
private val sliceIds = Project($doc(
|
||||
"_id" -> true,
|
||||
"v" -> true,
|
||||
|
@ -82,7 +82,7 @@ private final class AggregationPipeline {
|
|||
combineDocs(extraMatcher :: question.filters.collect {
|
||||
case f if f.dimension.isInMove => f.matcher
|
||||
}).some.filterNot(_.isEmpty) map Match
|
||||
def projectForMove = Project(BSONDocument({
|
||||
def projectForMove = Project($doc({
|
||||
metric.dbKey :: dimension.dbKey :: filters.collect {
|
||||
case Filter(d, _) if d.isInMove => d.dbKey
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ private final class AggregationPipeline {
|
|||
unwindMoves,
|
||||
matchMoves(),
|
||||
sampleMoves,
|
||||
group(dimension, AvgField(F.moves("c"))),
|
||||
group(dimension, Avg(F.moves("c"))),
|
||||
sliceIds
|
||||
)
|
||||
case M.Material => List(
|
||||
|
@ -112,7 +112,7 @@ private final class AggregationPipeline {
|
|||
unwindMoves,
|
||||
matchMoves(),
|
||||
sampleMoves,
|
||||
group(dimension, AvgField(F.moves("i"))),
|
||||
group(dimension, Avg(F.moves("i"))),
|
||||
sliceIds
|
||||
)
|
||||
case M.Opportunism => List(
|
||||
|
@ -177,11 +177,11 @@ private final class AggregationPipeline {
|
|||
sliceIds
|
||||
)
|
||||
case M.RatingDiff => List(
|
||||
group(dimension, AvgField(F.ratingDiff)),
|
||||
group(dimension, Avg(F.ratingDiff)),
|
||||
sliceIds
|
||||
)
|
||||
case M.OpponentRating => List(
|
||||
group(dimension, AvgField(F.opponentRating)),
|
||||
group(dimension, Avg(F.opponentRating)),
|
||||
sliceIds
|
||||
)
|
||||
case M.Result => List(
|
||||
|
|
|
@ -63,8 +63,6 @@ private final class Indexer(storage: Storage, sequencer: ActorRef) {
|
|||
.uno[Game]
|
||||
|
||||
private def computeFrom(user: User, from: DateTime, fromNumber: Int): Funit = {
|
||||
import reactivemongo.play.iteratees.cursorProducer
|
||||
|
||||
storage nbByPerf user.id flatMap { nbs =>
|
||||
var nbByPerf = nbs
|
||||
def toEntry(game: Game): Fu[Option[Entry]] = game.perfType ?? { pt =>
|
||||
|
@ -77,7 +75,7 @@ private final class Indexer(storage: Storage, sequencer: ActorRef) {
|
|||
}
|
||||
val query = gameQuery(user) ++ $doc(Game.BSONFields.createdAt $gte from)
|
||||
GameRepo.sortedCursor(query, Query.sortChronological)
|
||||
.enumerator(maxGames) &>
|
||||
.enumerate(maxGames, stopOnError = true) &>
|
||||
Enumeratee.grouped(Iteratee takeUpTo 4) &>
|
||||
Enumeratee.mapM[Seq[Game]].apply[Seq[Entry]] { games =>
|
||||
games.map(toEntry).sequenceFu.map(_.flatten).addFailureEffect { e =>
|
||||
|
|
|
@ -77,15 +77,10 @@ object Puzzle {
|
|||
case _ => sys error s"Invalid piotr move notation: $move"
|
||||
}
|
||||
def read(doc: BSONDocument): Lines = doc.elements.toList map {
|
||||
case BSONElement(move, BSONBoolean(true)) => Win(readMove(move))
|
||||
|
||||
case BSONElement(move, BSONBoolean(false)) => Retry(readMove(move))
|
||||
|
||||
case BSONElement(move, more: BSONDocument) =>
|
||||
Node(readMove(move), read(more))
|
||||
|
||||
case BSONElement(move, value) =>
|
||||
throw new Exception(s"Can't read value of $move: $value")
|
||||
case (move, BSONBoolean(true)) => Win(readMove(move))
|
||||
case (move, BSONBoolean(false)) => Retry(readMove(move))
|
||||
case (move, more: BSONDocument) => Node(readMove(move), read(more))
|
||||
case (move, value) => throw new Exception(s"Can't read value of $move: $value")
|
||||
}
|
||||
private def writeMove(move: String) = chess.Pos.doubleKeyToPiotr(move take 4) match {
|
||||
case Some(m) => s"$m${move drop 4}"
|
||||
|
|
|
@ -289,11 +289,10 @@ final class QaApi(
|
|||
// list all tags found in questions collection
|
||||
def all: Fu[List[Tag]] = cache(true) {
|
||||
val col = questionColl
|
||||
import reactivemongo.api.collections.bson.BSONBatchCommands.AggregationFramework.{ AddFieldToSet, Group, Project, UnwindField }
|
||||
import reactivemongo.api.collections.bson.BSONBatchCommands.AggregationFramework.{ AddToSet, Group, Project, Unwind }
|
||||
|
||||
col.aggregate(Project($doc("tags" -> BSONBoolean(true))), List(
|
||||
UnwindField("tags"), Group(
|
||||
BSONBoolean(true))("tags" -> AddFieldToSet("tags")))).
|
||||
Unwind("tags"), Group(BSONBoolean(true))("tags" -> AddToSet("tags")))).
|
||||
map(_.firstBatch.headOption.flatMap(_.getAs[List[String]]("tags")).
|
||||
getOrElse(List.empty[String]).map(_.toLowerCase).distinct)
|
||||
}
|
||||
|
|
|
@ -40,8 +40,8 @@ final class RelationApi(
|
|||
"r" -> Follow
|
||||
)), List(
|
||||
Group(BSONNull)(
|
||||
"u1" -> AddFieldToSet("u1"),
|
||||
"u2" -> AddFieldToSet("u2")),
|
||||
"u1" -> AddToSet("u1"),
|
||||
"u2" -> AddToSet("u2")),
|
||||
Project($id($doc("$setIntersection" -> $arr("$u1", "$u2"))))
|
||||
)).map {
|
||||
~_.firstBatch.headOption.flatMap(_.getAs[Set[String]]("_id")) - userId
|
||||
|
|
|
@ -28,9 +28,8 @@ private[round] final class Titivate(
|
|||
|
||||
def scheduleNext = scheduler.scheduleOnce(5 seconds, self, Run)
|
||||
|
||||
import reactivemongo.play.iteratees.cursorProducer
|
||||
|
||||
def receive = {
|
||||
|
||||
case ReceiveTimeout =>
|
||||
val msg = "Titivate timed out!"
|
||||
logger.error(msg)
|
||||
|
@ -38,7 +37,7 @@ private[round] final class Titivate(
|
|||
|
||||
case Run => GameRepo.count(_.checkable).flatMap { total =>
|
||||
GameRepo.cursor(Query.checkable)
|
||||
.enumerator(1000, Cursor.ContOnError())
|
||||
.enumerate(1000, stopOnError = false)
|
||||
.|>>>(Iteratee.foldM[Game, Int](0) {
|
||||
case (count, game) => {
|
||||
|
||||
|
|
|
@ -24,8 +24,7 @@ final class StudyRepo(private[study] val coll: Coll) {
|
|||
|
||||
def cursor(
|
||||
selector: Bdoc,
|
||||
readPreference: ReadPreference = ReadPreference.secondaryPreferred)(
|
||||
implicit cp: CursorProducer[Study]) =
|
||||
readPreference: ReadPreference = ReadPreference.secondaryPreferred) =
|
||||
coll.find(selector).cursor[Study](readPreference)
|
||||
|
||||
def nameById(id: Study.ID) = coll.primitiveOne[String]($id(id), "name")
|
||||
|
|
|
@ -76,12 +76,11 @@ final class StudySearchApi(
|
|||
private val multiSpaceRegex = """\s{2,}""".r
|
||||
private def noMultiSpace(text: String) = multiSpaceRegex.replaceAllIn(text, " ")
|
||||
|
||||
import reactivemongo.play.iteratees.cursorProducer
|
||||
def reset = client match {
|
||||
case c: ESClientHttp => c.putMapping >> {
|
||||
logger.info(s"Index to ${c.index.name}")
|
||||
import lila.db.dsl._
|
||||
studyRepo.cursor($empty).enumerator() |>>>
|
||||
studyRepo.cursor($empty).enumerate() |>>>
|
||||
Iteratee.foldM[Study, Int](0) {
|
||||
case (nb, study) => doStore(study) inject {
|
||||
if (nb % 100 == 0) logger.info(s"Indexed $nb studies")
|
||||
|
|
|
@ -20,8 +20,7 @@ object TeamRepo {
|
|||
|
||||
def cursor(
|
||||
selector: Bdoc,
|
||||
readPreference: ReadPreference = ReadPreference.secondaryPreferred)(
|
||||
implicit cp: CursorProducer[Team]) =
|
||||
readPreference: ReadPreference = ReadPreference.secondaryPreferred) =
|
||||
coll.find(selector).cursor[Team](readPreference)
|
||||
|
||||
def owned(id: String, createdBy: String): Fu[Option[Team]] =
|
||||
|
|
|
@ -27,18 +27,14 @@ final class TeamSearchApi(client: ESClient) extends SearchReadApi[Team, Query] {
|
|||
case c: ESClientHttp => c.putMapping >> {
|
||||
import play.api.libs.iteratee._
|
||||
import reactivemongo.api.ReadPreference
|
||||
import reactivemongo.play.iteratees.cursorProducer
|
||||
import lila.db.dsl._
|
||||
|
||||
logger.info(s"Index to ${c.index.name}")
|
||||
|
||||
val batchSize = 200
|
||||
val maxEntries = Int.MaxValue
|
||||
|
||||
TeamRepo.cursor(
|
||||
selector = $doc("enabled" -> true),
|
||||
readPreference = ReadPreference.secondaryPreferred)
|
||||
.enumerator(maxEntries) &>
|
||||
.enumerate(maxEntries, stopOnError = true) &>
|
||||
Enumeratee.grouped(Iteratee takeUpTo batchSize) |>>>
|
||||
Iteratee.foldM[Seq[Team], Int](0) {
|
||||
case (nb, teams) =>
|
||||
|
|
|
@ -29,7 +29,7 @@ final class LeaderboardApi(
|
|||
import reactivemongo.api.collections.bson.BSONBatchCommands.AggregationFramework._
|
||||
coll.aggregate(
|
||||
Match($doc("u" -> user.id)),
|
||||
List(GroupField("v")("nb" -> SumValue(1), "points" -> PushField("s"), "ratios" -> PushField("w")))
|
||||
List(GroupField("v")("nb" -> SumValue(1), "points" -> Push("s"), "ratios" -> Push("w")))
|
||||
).map {
|
||||
_.firstBatch map leaderboardAggregationResultBSONHandler.read
|
||||
}.map { aggs =>
|
||||
|
|
|
@ -16,11 +16,10 @@ private final class LeaderboardIndexer(
|
|||
import BSONHandlers._
|
||||
|
||||
def generateAll: Funit = leaderboardColl.remove(BSONDocument()) >> {
|
||||
import reactivemongo.play.iteratees.cursorProducer
|
||||
|
||||
tournamentColl.find(TournamentRepo.finishedSelect)
|
||||
.sort(BSONDocument("startsAt" -> -1))
|
||||
.cursor[Tournament]().enumerator(20 * 1000) &>
|
||||
.cursor[Tournament]()
|
||||
.enumerate(20 * 1000, stopOnError = true) &>
|
||||
Enumeratee.mapM[Tournament].apply[Seq[Entry]](generateTour) &>
|
||||
Enumeratee.mapConcat[Seq[Entry]].apply[Entry](identity) &>
|
||||
Enumeratee.grouped(Iteratee takeUpTo 500) |>>>
|
||||
|
|
|
@ -78,7 +78,7 @@ object PairingRepo {
|
|||
Match(selectTour(tourId)),
|
||||
List(
|
||||
Project($doc("u" -> true, "_id" -> false)),
|
||||
UnwindField("u"),
|
||||
Unwind("u"),
|
||||
GroupField("u")("nb" -> SumValue(1))
|
||||
)).map {
|
||||
_.firstBatch.flatMap { doc =>
|
||||
|
@ -125,19 +125,18 @@ object PairingRepo {
|
|||
$set(field -> value)).void
|
||||
}
|
||||
|
||||
import reactivemongo.api.collections.bson.BSONBatchCommands.AggregationFramework, AggregationFramework.{ AddFieldToSet, Group, Match, Project, PushField, UnwindField }
|
||||
import reactivemongo.api.collections.bson.BSONBatchCommands.AggregationFramework, AggregationFramework.{ AddToSet, Group, Match, Project, Push, Unwind }
|
||||
|
||||
def playingUserIds(tour: Tournament): Fu[Set[String]] =
|
||||
coll.aggregate(Match(selectTour(tour.id) ++ selectPlaying), List(
|
||||
Project($doc("u" -> true, "_id" -> false)),
|
||||
UnwindField("u"), Group(BSONBoolean(true))(
|
||||
"ids" -> AddFieldToSet("u")))).map(
|
||||
Unwind("u"), Group(BSONBoolean(true))("ids" -> AddToSet("u")))).map(
|
||||
_.firstBatch.headOption.flatMap(_.getAs[Set[String]]("ids")).
|
||||
getOrElse(Set.empty[String]))
|
||||
|
||||
def playingGameIds(tourId: String): Fu[List[String]] =
|
||||
coll.aggregate(Match(selectTour(tourId) ++ selectPlaying), List(
|
||||
Group(BSONBoolean(true))("ids" -> PushField("_id")))).map(
|
||||
Group(BSONBoolean(true))("ids" -> Push("_id")))).map(
|
||||
_.firstBatch.headOption.flatMap(_.getAs[List[String]]("ids")).
|
||||
getOrElse(List.empty[String]))
|
||||
}
|
||||
|
|
|
@ -99,7 +99,7 @@ object PlayerRepo {
|
|||
private def aggregationUserIdList(res: Stream[Bdoc]): List[String] =
|
||||
res.headOption flatMap { _.getAs[List[String]]("uids") } getOrElse Nil
|
||||
|
||||
import reactivemongo.api.collections.bson.BSONBatchCommands.AggregationFramework.{ Descending, Group, Match, PushField, Sort }
|
||||
import reactivemongo.api.collections.bson.BSONBatchCommands.AggregationFramework.{ Descending, Group, Match, Push, Sort }
|
||||
|
||||
def userIds(tourId: String): Fu[List[String]] =
|
||||
coll.distinct[String, List]("uid", selectTour(tourId).some)
|
||||
|
@ -114,7 +114,7 @@ object PlayerRepo {
|
|||
// freaking expensive (marathons)
|
||||
private[tournament] def computeRanking(tourId: String): Fu[Ranking] =
|
||||
coll.aggregate(Match(selectTour(tourId)), List(Sort(Descending("m")),
|
||||
Group(BSONNull)("uids" -> PushField("uid")))) map {
|
||||
Group(BSONNull)("uids" -> Push("uid")))) map {
|
||||
_.firstBatch.headOption.fold(Map.empty: Ranking) {
|
||||
_ get "uids" match {
|
||||
case Some(BSONArray(uids)) =>
|
||||
|
|
|
@ -124,8 +124,7 @@ object UserRepo {
|
|||
def setPerfs(user: User, perfs: Perfs, prev: Perfs) = {
|
||||
val diff = PerfType.all flatMap { pt =>
|
||||
perfs(pt).nb != prev(pt).nb option {
|
||||
BSONElement(
|
||||
s"${F.perfs}.${pt.key}", Perf.perfBSONHandler.write(perfs(pt)))
|
||||
s"${F.perfs}.${pt.key}" -> Perf.perfBSONHandler.write(perfs(pt))
|
||||
}
|
||||
}
|
||||
diff.nonEmpty ?? coll.update(
|
||||
|
@ -171,7 +170,7 @@ object UserRepo {
|
|||
val sortCreatedAtDesc = $sort desc F.createdAt
|
||||
|
||||
def incNbGames(id: ID, rated: Boolean, ai: Boolean, result: Int, totalTime: Option[Int], tvTime: Option[Int]) = {
|
||||
val incs: List[BSONElement] = List(
|
||||
val incs: List[(String, BSONInteger)] = List(
|
||||
"count.game".some,
|
||||
rated option "count.rated",
|
||||
ai option "count.ai",
|
||||
|
@ -187,9 +186,9 @@ object UserRepo {
|
|||
case 0 => "count.drawH".some
|
||||
case _ => none
|
||||
}) ifFalse ai
|
||||
).flatten.map(k => BSONElement(k, BSONInteger(1))) ::: List(
|
||||
totalTime map BSONInteger.apply map(v => BSONElement(s"${F.playTime}.total", v)),
|
||||
tvTime map BSONInteger.apply map(v => BSONElement(s"${F.playTime}.tv", v))
|
||||
).flatten.map(_ -> BSONInteger(1)) ::: List(
|
||||
totalTime map BSONInteger.apply map (s"${F.playTime}.total" -> _),
|
||||
tvTime map BSONInteger.apply map (s"${F.playTime}.tv" -> _)
|
||||
).flatten
|
||||
|
||||
coll.update($id(id), $inc(incs))
|
||||
|
@ -333,7 +332,7 @@ object UserRepo {
|
|||
coll.updateFieldUnchecked($id(id), "seenAt", DateTime.now)
|
||||
}
|
||||
|
||||
def recentlySeenNotKidIdsCursor(since: DateTime)(implicit cp: CursorProducer[Bdoc]) =
|
||||
def recentlySeenNotKidIdsCursor(since: DateTime) =
|
||||
coll.find($doc(
|
||||
F.enabled -> true,
|
||||
"seenAt" $gt since,
|
||||
|
|
|
@ -170,7 +170,7 @@ private[video] final class VideoApi(
|
|||
|
||||
private val max = 25
|
||||
|
||||
import reactivemongo.api.collections.bson.BSONBatchCommands.AggregationFramework.{ Descending, GroupField, Match, Project, UnwindField, Sort, SumValue }
|
||||
import reactivemongo.api.collections.bson.BSONBatchCommands.AggregationFramework.{ Descending, GroupField, Match, Project, Unwind, Sort, SumValue }
|
||||
|
||||
private val pathsCache = AsyncCache[List[Tag], List[TagNb]](
|
||||
f = filterTags => {
|
||||
|
@ -180,8 +180,8 @@ private[video] final class VideoApi(
|
|||
}
|
||||
else videoColl.aggregate(
|
||||
Match($doc("tags" $all filterTags)),
|
||||
List(Project($doc("tags" -> true)), UnwindField("tags"),
|
||||
GroupField("tags")("nb" -> SumValue(1)))).map(
|
||||
List(Project($doc("tags" -> true)),
|
||||
Unwind("tags"), GroupField("tags")("nb" -> SumValue(1)))).map(
|
||||
_.firstBatch.flatMap(_.asOpt[TagNb]))
|
||||
|
||||
allPopular zip allPaths map {
|
||||
|
@ -206,7 +206,7 @@ private[video] final class VideoApi(
|
|||
private val popularCache = AsyncCache.single[List[TagNb]](
|
||||
f = videoColl.aggregate(
|
||||
Project($doc("tags" -> true)), List(
|
||||
UnwindField("tags"), GroupField("tags")("nb" -> SumValue(1)),
|
||||
Unwind("tags"), GroupField("tags")("nb" -> SumValue(1)),
|
||||
Sort(Descending("nb")))).map(
|
||||
_.firstBatch.flatMap(_.asOpt[TagNb])),
|
||||
timeToLive = 1.day)
|
||||
|
|
|
@ -33,7 +33,7 @@ object ApplicationBuild extends Build {
|
|||
// offline := true,
|
||||
libraryDependencies ++= Seq(
|
||||
scalaz, scalalib, hasher, config, apache,
|
||||
jgit, findbugs, reactivemongo.driver, reactivemongo.iteratees, akka.actor, akka.slf4j,
|
||||
jgit, findbugs, RM, akka.actor, akka.slf4j,
|
||||
spray.caching, maxmind, prismic,
|
||||
kamon.core, kamon.statsd, java8compat, semver, scrimage),
|
||||
TwirlKeys.templateImports ++= Seq(
|
||||
|
@ -68,35 +68,34 @@ object ApplicationBuild extends Build {
|
|||
lazy val api = project("api", moduleCPDeps)
|
||||
.settings(
|
||||
libraryDependencies ++= provided(
|
||||
play.api, hasher, config, apache, jgit, findbugs,
|
||||
reactivemongo.driver, reactivemongo.iteratees,
|
||||
play.api, hasher, config, apache, jgit, findbugs, RM,
|
||||
kamon.core, kamon.statsd)
|
||||
) aggregate (moduleRefs: _*)
|
||||
|
||||
lazy val puzzle = project("puzzle", Seq(
|
||||
common, memo, hub, db, user, rating)).settings(
|
||||
libraryDependencies ++= provided(play.api, reactivemongo.driver)
|
||||
libraryDependencies ++= provided(play.api, RM)
|
||||
)
|
||||
|
||||
lazy val quote = project("quote", Seq())
|
||||
|
||||
lazy val opening = project("opening", Seq(
|
||||
common, memo, hub, db, user)).settings(
|
||||
libraryDependencies ++= provided(play.api, reactivemongo.driver)
|
||||
libraryDependencies ++= provided(play.api, RM)
|
||||
)
|
||||
|
||||
lazy val video = project("video", Seq(
|
||||
common, memo, hub, db, user)).settings(
|
||||
libraryDependencies ++= provided(play.api, reactivemongo.driver)
|
||||
libraryDependencies ++= provided(play.api, RM)
|
||||
)
|
||||
|
||||
lazy val coach = project("coach", Seq(
|
||||
common, hub, db, user, security, notifyModule)).settings(
|
||||
libraryDependencies ++= provided(play.api, reactivemongo.driver, scrimage)
|
||||
libraryDependencies ++= provided(play.api, RM, scrimage)
|
||||
)
|
||||
|
||||
lazy val coordinate = project("coordinate", Seq(common, db)).settings(
|
||||
libraryDependencies ++= provided(play.api, reactivemongo.driver)
|
||||
libraryDependencies ++= provided(play.api, RM)
|
||||
)
|
||||
|
||||
lazy val worldMap = project("worldMap", Seq(common, hub, memo, rating)).settings(
|
||||
|
@ -104,46 +103,45 @@ object ApplicationBuild extends Build {
|
|||
)
|
||||
|
||||
lazy val qa = project("qa", Seq(common, db, memo, user, security, notifyModule)).settings(
|
||||
libraryDependencies ++= provided(play.api, reactivemongo.driver)
|
||||
libraryDependencies ++= provided(play.api, RM)
|
||||
)
|
||||
|
||||
lazy val blog = project("blog", Seq(common, memo, user, message)).settings(
|
||||
libraryDependencies ++= provided(play.api, prismic,
|
||||
reactivemongo.driver, reactivemongo.iteratees)
|
||||
libraryDependencies ++= provided(play.api, RM, prismic)
|
||||
)
|
||||
|
||||
lazy val evaluation = project("evaluation", Seq(
|
||||
common, hub, db, user, game, analyse)).settings(
|
||||
libraryDependencies ++= provided(play.api, reactivemongo.driver)
|
||||
libraryDependencies ++= provided(play.api, RM)
|
||||
)
|
||||
|
||||
// lazy val simulation = project("simulation", Seq(
|
||||
// common, hub, socket, game, tv, round, setup)).settings(
|
||||
// libraryDependencies ++= provided(play.api, reactivemongo.driver)
|
||||
// libraryDependencies ++= provided(play.api, RM)
|
||||
// )
|
||||
|
||||
lazy val common = project("common").settings(
|
||||
libraryDependencies ++= provided(play.api, play.test, reactivemongo.driver, kamon.core)
|
||||
libraryDependencies ++= provided(play.api, play.test, RM, kamon.core)
|
||||
)
|
||||
|
||||
lazy val rating = project("rating", Seq(common, db, chess)).settings(
|
||||
libraryDependencies ++= provided(play.api, reactivemongo.driver)
|
||||
libraryDependencies ++= provided(play.api, RM)
|
||||
)
|
||||
|
||||
lazy val perfStat = project("perfStat", Seq(common, db, chess, user, game, rating)).settings(
|
||||
libraryDependencies ++= provided(play.api, reactivemongo.driver)
|
||||
libraryDependencies ++= provided(play.api, RM)
|
||||
)
|
||||
|
||||
lazy val history = project("history", Seq(common, db, memo, game, user)).settings(
|
||||
libraryDependencies ++= provided(play.api, reactivemongo.driver)
|
||||
libraryDependencies ++= provided(play.api, RM)
|
||||
)
|
||||
|
||||
lazy val db = project("db", Seq(common)).settings(
|
||||
libraryDependencies ++= provided(play.test, play.api, reactivemongo.driver, hasher)
|
||||
libraryDependencies ++= provided(play.test, play.api, RM, hasher)
|
||||
)
|
||||
|
||||
lazy val memo = project("memo", Seq(common, db)).settings(
|
||||
libraryDependencies ++= Seq(guava, findbugs, spray.caching) ++ provided(play.api, reactivemongo.driver)
|
||||
libraryDependencies ++= Seq(guava, findbugs, spray.caching) ++ provided(play.api, RM)
|
||||
)
|
||||
|
||||
lazy val search = project("search", Seq(common, hub)).settings(
|
||||
|
@ -151,154 +149,148 @@ object ApplicationBuild extends Build {
|
|||
)
|
||||
|
||||
lazy val chat = project("chat", Seq(common, db, user, security, i18n, socket)).settings(
|
||||
libraryDependencies ++= provided(play.api, reactivemongo.driver)
|
||||
libraryDependencies ++= provided(play.api, RM)
|
||||
)
|
||||
|
||||
lazy val timeline = project("timeline", Seq(common, db, game, user, hub, security, relation)).settings(
|
||||
libraryDependencies ++= provided(play.api, play.test, reactivemongo.driver)
|
||||
libraryDependencies ++= provided(play.api, play.test, RM)
|
||||
)
|
||||
|
||||
lazy val event = project("event", Seq(common, db, memo)).settings(
|
||||
libraryDependencies ++= provided(play.api, play.test, reactivemongo.driver)
|
||||
libraryDependencies ++= provided(play.api, play.test, RM)
|
||||
)
|
||||
|
||||
lazy val mod = project("mod", Seq(common, db, user, hub, security, tournament, simul, game, analyse, evaluation,
|
||||
report, notifyModule, history)).settings(
|
||||
libraryDependencies ++= provided(play.api, play.test, reactivemongo.driver)
|
||||
libraryDependencies ++= provided(play.api, play.test, RM)
|
||||
)
|
||||
|
||||
lazy val user = project("user", Seq(common, memo, db, hub, chess, rating)).settings(
|
||||
libraryDependencies ++= provided(play.api, play.test, reactivemongo.driver, hasher)
|
||||
libraryDependencies ++= provided(play.api, play.test, RM, hasher)
|
||||
)
|
||||
|
||||
lazy val game = project("game", Seq(common, memo, db, hub, user, chess, chat)).settings(
|
||||
libraryDependencies ++= provided(play.api, reactivemongo.driver, reactivemongo.iteratees)
|
||||
libraryDependencies ++= provided(play.api, RM)
|
||||
)
|
||||
|
||||
lazy val gameSearch = project("gameSearch", Seq(common, hub, chess, search, game)).settings(
|
||||
libraryDependencies ++= provided(
|
||||
play.api, reactivemongo.driver, reactivemongo.iteratees))
|
||||
play.api, RM))
|
||||
|
||||
lazy val tv = project("tv", Seq(common, db, hub, socket, game, user, chess)).settings(
|
||||
libraryDependencies ++= provided(play.api, reactivemongo.driver, hasher)
|
||||
libraryDependencies ++= provided(play.api, RM, hasher)
|
||||
)
|
||||
|
||||
lazy val analyse = project("analyse", Seq(common, hub, chess, game, user, notifyModule)).settings(
|
||||
libraryDependencies ++= provided(play.api, reactivemongo.driver, spray.caching)
|
||||
libraryDependencies ++= provided(play.api, RM, spray.caching)
|
||||
)
|
||||
|
||||
lazy val round = project("round", Seq(
|
||||
common, db, memo, hub, socket, chess, game, user,
|
||||
i18n, fishnet, pref, chat, history, playban)).settings(
|
||||
libraryDependencies ++= provided(play.api, hasher, kamon.core,
|
||||
reactivemongo.driver, reactivemongo.iteratees)
|
||||
libraryDependencies ++= provided(play.api, RM, hasher, kamon.core)
|
||||
)
|
||||
|
||||
lazy val lobby = project("lobby", Seq(
|
||||
common, db, memo, hub, socket, chess, game, user, round, timeline, relation, playban, security)).settings(
|
||||
libraryDependencies ++= provided(play.api, reactivemongo.driver)
|
||||
libraryDependencies ++= provided(play.api, RM)
|
||||
)
|
||||
|
||||
lazy val setup = project("setup", Seq(
|
||||
common, db, memo, hub, socket, chess, game, user, lobby, pref, relation)).settings(
|
||||
libraryDependencies ++= provided(play.api, reactivemongo.driver)
|
||||
libraryDependencies ++= provided(play.api, RM)
|
||||
)
|
||||
|
||||
lazy val importer = project("importer", Seq(common, chess, game, round)).settings(
|
||||
libraryDependencies ++= provided(play.api, reactivemongo.driver)
|
||||
libraryDependencies ++= provided(play.api, RM)
|
||||
)
|
||||
|
||||
lazy val insight = project("insight",
|
||||
Seq(common, chess, game, user, analyse, relation, pref, socket, round, security)
|
||||
).settings(
|
||||
libraryDependencies ++= provided(play.api,
|
||||
reactivemongo.driver, reactivemongo.iteratees)
|
||||
libraryDependencies ++= provided(play.api, RM)
|
||||
)
|
||||
|
||||
lazy val tournament = project("tournament", Seq(
|
||||
common, hub, socket, chess, game, round, security, chat, memo, quote, history, notifyModule)).settings(
|
||||
libraryDependencies ++= provided(play.api,
|
||||
reactivemongo.driver, reactivemongo.iteratees)
|
||||
libraryDependencies ++= provided(play.api, RM)
|
||||
)
|
||||
|
||||
lazy val simul = project("simul", Seq(
|
||||
common, hub, socket, chess, game, round, chat, memo, quote)).settings(
|
||||
libraryDependencies ++= provided(play.api, reactivemongo.driver)
|
||||
libraryDependencies ++= provided(play.api, RM)
|
||||
)
|
||||
|
||||
lazy val fishnet = project("fishnet", Seq(common, chess, game, analyse, db)).settings(
|
||||
libraryDependencies ++= provided(play.api, reactivemongo.driver, semver)
|
||||
libraryDependencies ++= provided(play.api, RM, semver)
|
||||
)
|
||||
|
||||
lazy val security = project("security", Seq(common, hub, db, user)).settings(
|
||||
libraryDependencies ++= provided(play.api, reactivemongo.driver, maxmind, hasher)
|
||||
libraryDependencies ++= provided(play.api, RM, maxmind, hasher)
|
||||
)
|
||||
|
||||
lazy val shutup = project("shutup", Seq(common, db, hub, game, relation)).settings(
|
||||
libraryDependencies ++= provided(play.api, reactivemongo.driver)
|
||||
libraryDependencies ++= provided(play.api, RM)
|
||||
)
|
||||
|
||||
lazy val challenge = project("challenge", Seq(common, db, hub, setup, game)).settings(
|
||||
libraryDependencies ++= provided(play.api, reactivemongo.driver)
|
||||
libraryDependencies ++= provided(play.api, RM)
|
||||
)
|
||||
|
||||
lazy val study = project("study", Seq(common, db, hub, socket, game, round, importer, notifyModule, relation)).settings(
|
||||
libraryDependencies ++= provided(play.api, reactivemongo.driver)
|
||||
libraryDependencies ++= provided(play.api, RM)
|
||||
)
|
||||
|
||||
lazy val studySearch = project("studySearch", Seq(common, hub, study, search)).settings(
|
||||
libraryDependencies ++= provided(play.api,
|
||||
reactivemongo.driver, reactivemongo.iteratees)
|
||||
libraryDependencies ++= provided(play.api, RM)
|
||||
)
|
||||
|
||||
lazy val learn = project("learn", Seq(common, db, user)).settings(
|
||||
libraryDependencies ++= provided(play.api, reactivemongo.driver)
|
||||
libraryDependencies ++= provided(play.api, RM)
|
||||
)
|
||||
|
||||
lazy val playban = project("playban", Seq(common, db, game)).settings(
|
||||
libraryDependencies ++= provided(play.api, reactivemongo.driver)
|
||||
libraryDependencies ++= provided(play.api, RM)
|
||||
)
|
||||
|
||||
lazy val push = project("push", Seq(common, db, user, game, challenge, message)).settings(
|
||||
libraryDependencies ++= provided(play.api, reactivemongo.driver)
|
||||
libraryDependencies ++= provided(play.api, RM)
|
||||
)
|
||||
|
||||
lazy val slack = project("slack", Seq(common, hub, user)).settings(
|
||||
libraryDependencies ++= provided(play.api, reactivemongo.driver)
|
||||
libraryDependencies ++= provided(play.api, RM)
|
||||
)
|
||||
|
||||
lazy val plan = project("plan", Seq(common, user, notifyModule)).settings(
|
||||
libraryDependencies ++= provided(play.api, reactivemongo.driver)
|
||||
libraryDependencies ++= provided(play.api, RM)
|
||||
)
|
||||
|
||||
lazy val relation = project("relation", Seq(common, db, memo, hub, user, game, pref)).settings(
|
||||
libraryDependencies ++= provided(play.api, reactivemongo.driver)
|
||||
libraryDependencies ++= provided(play.api, RM)
|
||||
)
|
||||
|
||||
lazy val pref = project("pref", Seq(common, db, user)).settings(
|
||||
libraryDependencies ++= provided(play.api, reactivemongo.driver)
|
||||
libraryDependencies ++= provided(play.api, RM)
|
||||
)
|
||||
|
||||
lazy val message = project("message", Seq(common, db, user, hub, relation, security, notifyModule)).settings(
|
||||
libraryDependencies ++= provided(play.api, reactivemongo.driver, spray.caching)
|
||||
libraryDependencies ++= provided(play.api, RM, spray.caching)
|
||||
)
|
||||
|
||||
lazy val forum = project("forum", Seq(common, db, user, security, hub, mod, notifyModule)).settings(
|
||||
libraryDependencies ++= provided(play.api, reactivemongo.driver, spray.caching)
|
||||
libraryDependencies ++= provided(play.api, RM, spray.caching)
|
||||
)
|
||||
|
||||
lazy val forumSearch = project("forumSearch", Seq(common, hub, forum, search)).settings(
|
||||
libraryDependencies ++= provided(play.api,
|
||||
reactivemongo.driver, reactivemongo.iteratees)
|
||||
libraryDependencies ++= provided(play.api, RM)
|
||||
)
|
||||
|
||||
lazy val team = project("team", Seq(common, memo, db, user, forum, security, hub, notifyModule)).settings(
|
||||
libraryDependencies ++= provided(play.api, reactivemongo.driver)
|
||||
libraryDependencies ++= provided(play.api, RM)
|
||||
)
|
||||
|
||||
lazy val teamSearch = project("teamSearch", Seq(common, hub, team, search)).settings(
|
||||
libraryDependencies ++= provided(play.api,
|
||||
reactivemongo.driver, reactivemongo.iteratees)
|
||||
libraryDependencies ++= provided(play.api, RM)
|
||||
)
|
||||
|
||||
lazy val i18n = project("i18n", Seq(common, db, user, hub)).settings(
|
||||
|
@ -308,26 +300,25 @@ object ApplicationBuild extends Build {
|
|||
(sourceManaged in Compile).value / "messages"
|
||||
)
|
||||
}.taskValue,
|
||||
libraryDependencies ++= provided(play.api, reactivemongo.driver, jgit)
|
||||
libraryDependencies ++= provided(play.api, RM, jgit)
|
||||
)
|
||||
|
||||
lazy val bookmark = project("bookmark", Seq(common, memo, db, hub, user, game)).settings(
|
||||
libraryDependencies ++= provided(
|
||||
play.api, play.test, reactivemongo.driver)
|
||||
play.api, play.test, RM)
|
||||
)
|
||||
|
||||
lazy val report = project("report", Seq(common, db, user)).settings(
|
||||
libraryDependencies ++= provided(
|
||||
play.api, reactivemongo.driver)
|
||||
play.api, RM)
|
||||
)
|
||||
|
||||
lazy val explorer = project("explorer", Seq(common, db, game)).settings(
|
||||
libraryDependencies ++= provided(play.api,
|
||||
reactivemongo.driver, reactivemongo.iteratees)
|
||||
libraryDependencies ++= provided(play.api, RM)
|
||||
)
|
||||
|
||||
lazy val notifyModule = project("notify", Seq(common, db, user, hub, relation)).settings(
|
||||
libraryDependencies ++= provided(play.api, reactivemongo.driver)
|
||||
libraryDependencies ++= provided(play.api, RM)
|
||||
)
|
||||
|
||||
lazy val site = project("site", Seq(common, socket)).settings(
|
||||
|
|
|
@ -34,19 +34,13 @@ object Dependencies {
|
|||
val hasher = "com.roundeights" %% "hasher" % "1.2.0"
|
||||
val jgit = "org.eclipse.jgit" % "org.eclipse.jgit" % "3.2.0.201312181205-r"
|
||||
val jodaTime = "joda-time" % "joda-time" % "2.9.4"
|
||||
|
||||
val RM = "org.reactivemongo" %% "reactivemongo" % "0.12-RC3"
|
||||
val maxmind = "com.sanoma.cda" %% "maxmind-geoip2-scala" % "1.2.3-THIB"
|
||||
val prismic = "io.prismic" %% "scala-kit" % "1.2.11-THIB"
|
||||
val java8compat = "org.scala-lang.modules" %% "scala-java8-compat" % "0.7.0"
|
||||
val semver = "com.gilt" %% "gfc-semver" % "0.0.3"
|
||||
val scrimage = "com.sksamuel.scrimage" %% "scrimage-core" % "2.1.7"
|
||||
|
||||
object reactivemongo {
|
||||
val version = "0.12.0"
|
||||
val driver = "org.reactivemongo" %% "reactivemongo" % version
|
||||
val iteratees = "org.reactivemongo" %% "reactivemongo-iteratees" % version
|
||||
}
|
||||
|
||||
object play {
|
||||
val version = "2.4.6"
|
||||
val api = "com.typesafe.play" %% "play" % version
|
||||
|
|
Loading…
Reference in New Issue