add storm perf to user API - closes #8017
This commit is contained in:
parent
0c3f48921a
commit
a52b628b22
|
@ -1,10 +1,10 @@
|
|||
package lila.user
|
||||
|
||||
import play.api.libs.json._
|
||||
import User.{ LightPerf, PlayTime }
|
||||
|
||||
import lila.common.Json.jodaWrites
|
||||
import lila.rating.{ Perf, PerfType }
|
||||
import User.{ LightPerf, PlayTime }
|
||||
|
||||
final class JsonView(isOnline: lila.socket.IsOnline) {
|
||||
|
||||
|
@ -108,7 +108,13 @@ object JsonView {
|
|||
JsObject(u.perfs.perfsMap collect {
|
||||
case (key, perf) if onlyPerf.fold(select(key, perf))(_.key == key) =>
|
||||
key -> perfWrites.writes(perf)
|
||||
})
|
||||
}).add(
|
||||
"storm",
|
||||
u.perfs.storm.nonEmpty option Json.obj(
|
||||
"runs" -> u.perfs.storm.runs,
|
||||
"score" -> u.perfs.storm.score
|
||||
)
|
||||
)
|
||||
|
||||
def perfs(u: User, onlyPerfs: List[PerfType]) =
|
||||
JsObject(onlyPerfs.map { perfType =>
|
||||
|
|
Loading…
Reference in a new issue