convert to db date format
This commit is contained in:
parent
c6ed3b43db
commit
d36b15da71
|
@ -43,7 +43,7 @@ private[bookmark] object BookmarkRepo {
|
|||
"_id" -> makeId(gameId, userId),
|
||||
"g" -> gameId,
|
||||
"u" -> userId,
|
||||
"d" -> date))
|
||||
"d" -> $date(date)))
|
||||
|
||||
def userIdQuery(userId: String) = Json.obj("u" -> userId)
|
||||
def makeId(gameId: String, userId: String) = gameId + userId
|
||||
|
|
|
@ -57,7 +57,7 @@ object Featured {
|
|||
|
||||
case object GetOne
|
||||
|
||||
def best(games: List[Game]) = (games sortBy score).lastOption
|
||||
def best(games: List[Game]) = (games.pp sortBy score).lastOption
|
||||
|
||||
def score(game: Game): Float = heuristics map {
|
||||
case (fn, coefficient) ⇒ heuristicBox(fn(game)) * coefficient
|
||||
|
@ -76,7 +76,7 @@ object Featured {
|
|||
progressHeuristic -> 0.5f)
|
||||
|
||||
def eloHeuristic(color: Color): Heuristic = game ⇒
|
||||
eloBox(game.player(color).elo | 1000)
|
||||
eloBox(game.player(color).elo | 1100)
|
||||
|
||||
def speedHeuristic: Heuristic = game ⇒
|
||||
1 - timeBox(game.estimateTotalTime)
|
||||
|
|
|
@ -138,15 +138,15 @@ object GameRepo {
|
|||
|
||||
def unplayedIds: Fu[List[ID]] = $primitive(
|
||||
Json.obj("t" -> $lt(2)) ++
|
||||
Json.obj(createdAt -> ($lt(DateTime.now - 3.day) ++ $gt(DateTime.now - 1.week))),
|
||||
Json.obj(createdAt -> ($lt($date(DateTime.now - 3.day)) ++ $gt($date(DateTime.now - 1.week)))),
|
||||
"_id"
|
||||
)(_.asOpt[ID])
|
||||
|
||||
def featuredCandidates: Fu[List[Game]] = $find(
|
||||
Query.playable ++ Query.clock(true) ++ Json.obj(
|
||||
"t" -> $gt(1),
|
||||
createdAt -> $gt(DateTime.now - 4.minutes),
|
||||
updatedAt -> $gt(DateTime.now - 15.seconds)
|
||||
createdAt -> $gt($date(DateTime.now - 4.minutes)),
|
||||
updatedAt -> $gt($date(DateTime.now - 15.seconds))
|
||||
))
|
||||
|
||||
def count(query: Query.type ⇒ JsObject): Fu[Int] = $count(query(Query))
|
||||
|
@ -159,7 +159,7 @@ object GameRepo {
|
|||
((days to 1 by -1).toList map { day ⇒
|
||||
val from = DateTime.now.withTimeAtStartOfDay - day.days
|
||||
val to = from + 1.day
|
||||
$count(Json.obj(createdAt -> ($gte(from) ++ $lt(to))))
|
||||
$count(Json.obj(createdAt -> ($gte($date(from)) ++ $lt($date(to)))))
|
||||
}).sequence
|
||||
|
||||
def recentAverageElo(minutes: Int): Fu[(Int, Int)] = {
|
||||
|
@ -183,7 +183,7 @@ object GameRepo {
|
|||
return nb == 0 ? nb : Math.round(sum / nb);
|
||||
}""",
|
||||
query = Some(JsObjectWriter write Json.obj(
|
||||
createdAt -> $gte(DateTime.now - minutes.minutes),
|
||||
createdAt -> $gte($date(DateTime.now - minutes.minutes)),
|
||||
"p.elo" -> $exists(true)
|
||||
))
|
||||
)
|
||||
|
|
|
@ -27,7 +27,7 @@ object TeamRepo {
|
|||
|
||||
def userHasCreatedSince(userId: String, duration: Period): Fu[Boolean] =
|
||||
$count.exists(Json.obj(
|
||||
"createdAt" -> $gt(DateTime.now - duration),
|
||||
"createdAt" -> $gt($date(DateTime.now - duration)),
|
||||
"createdBy" -> userId
|
||||
))
|
||||
|
||||
|
|
|
@ -5,7 +5,6 @@ import lila.db.Implicits._
|
|||
import tube.tournamentTube
|
||||
|
||||
import play.api.libs.json._
|
||||
import org.joda.time.DateTime
|
||||
import org.scala_tools.time.Imports._
|
||||
|
||||
object TournamentRepo {
|
||||
|
|
1
todo
1
todo
|
@ -50,7 +50,6 @@ explain point of importing games
|
|||
captcha highlight opponent king
|
||||
lightning/blitz/standard/untimed ratings http://www.freechess.org/Help/HelpFiles/blitz.html
|
||||
forum posts on user page http://en.lichess.org/forum/lichess-feedback/list-forum-posts-in-user-account#1
|
||||
show forum search everywhere
|
||||
better admin tools for team forums http://en.lichess.org/inbox/r8scbx64
|
||||
optional email http://en.lichess.org/forum/lichess-feedback/secret-question----password-recovery
|
||||
answer http://en.lichess.org/forum/lichess-feedback/expanded-chat-functionality-perhaps
|
||||
|
|
Loading…
Reference in a new issue