redefine abandoned games
parent
2e447a52b5
commit
f8bf12ddc4
|
@ -313,9 +313,7 @@ case class Game(
|
|||
|
||||
def olderThan(seconds: Int) = updatedAt.??(_ < DateTime.now - seconds.seconds)
|
||||
|
||||
def abandoned = updatedAt ?? { u ⇒
|
||||
(status <= Status.Started) && (u <= Game.abandonedDate)
|
||||
}
|
||||
def abandoned = (status <= Status.Started) && (updatedAt | createdAt) < Game.abandonedDate
|
||||
|
||||
def hasBookmarks = bookmarks > 0
|
||||
|
||||
|
@ -384,7 +382,7 @@ object Game {
|
|||
val updatedAt = "ua"
|
||||
}
|
||||
|
||||
def abandonedDate = DateTime.now - 10.days
|
||||
def abandonedDate = DateTime.now - 7.days
|
||||
|
||||
def takeGameId(fullId: String) = fullId take gameIdSize
|
||||
def takePlayerId(fullId: String) = fullId drop gameIdSize
|
||||
|
|
|
@ -66,7 +66,13 @@ object Query {
|
|||
def finishByClock = playable ++ clock(true) ++ Json.obj(
|
||||
createdAt -> $gt($date(DateTime.now - 3.hour)))
|
||||
|
||||
def abandoned = notFinished ++ Json.obj(updatedAt -> $lt($date(Game.abandonedDate)))
|
||||
def abandoned = {
|
||||
val date = $date(Game.abandonedDate)
|
||||
notFinished ++ $or(Seq(
|
||||
Json.obj(updatedAt -> $lt(date)),
|
||||
Json.obj(updatedAt -> $exists(false), createdAt -> $lt(date))
|
||||
))
|
||||
}
|
||||
|
||||
val sortCreated = $sort desc createdAt
|
||||
|
||||
|
|
Loading…
Reference in New Issue