code tweaks

This commit is contained in:
Thibault Duplessis 2017-03-27 12:16:33 +02:00
parent 115f8eb0ac
commit 6405fff999
2 changed files with 2 additions and 3 deletions

View file

@ -121,7 +121,6 @@ object User {
def tvPeriod = new Period(tv * 1000l)
def nonEmptyTvPeriod = (tv > 0) option tvPeriod
}
import lila.db.BSON.BSONJodaDateTimeHandler
implicit def playTimeHandler = reactivemongo.bson.Macros.handler[PlayTime]
// Matches a lichess username with an '@' prefix if it is used as a single

View file

@ -203,8 +203,8 @@ object UserRepo {
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))
totalTime map (v => BSONElement(s"${F.playTime}.total", BSONInteger(v))),
tvTime map (v => BSONElement(s"${F.playTime}.tv", BSONInteger(v)))
).flatten
coll.update($id(id), $inc(incs))