oh wow it's working
parent
0b18d36c61
commit
48391900d6
|
@ -16,6 +16,19 @@ object Coach extends LilaController {
|
|||
}
|
||||
}
|
||||
|
||||
def ask(username: String) = Open { implicit ctx =>
|
||||
import lila.coach.{ Question, Dimension, Metric }
|
||||
Accessible(username) { user =>
|
||||
env.api.ask(Question[lila.coach.Ecopening, Dimension[lila.coach.Ecopening]](
|
||||
xAxis = Dimension.Opening: Dimension[lila.coach.Ecopening],
|
||||
yAxis = Metric.Movetime,
|
||||
filters = Nil
|
||||
), user) map { answer =>
|
||||
Ok(html.coach.answer(answer, user))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private def Accessible(username: String)(f: lila.user.User => Fu[Result])(implicit ctx: Context) =
|
||||
lila.user.UserRepo named username flatMap {
|
||||
case None => notFound
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
@(answer: lila.coach.Answer[_, _], u: User)(implicit ctx: Context)
|
||||
|
||||
@coach.layout(u, title = s"${u.username} coach") {
|
||||
|
||||
@answer
|
||||
}
|
|
@ -44,6 +44,7 @@ GET /rel/blocks controllers.Relation.blocks
|
|||
|
||||
# Coach
|
||||
POST /coach/refresh/:username controllers.Coach.refresh(username: String)
|
||||
GET /coach/:username controllers.Coach.ask(username: String)
|
||||
|
||||
# User
|
||||
GET /@/:username/opponents controllers.User.opponents(username: String)
|
||||
|
|
|
@ -36,7 +36,7 @@ final class CoachApi(coll: Coll) {
|
|||
}
|
||||
}
|
||||
|
||||
private val unwindMoves = Unwind("$moves").some
|
||||
private val unwindMoves = Unwind("moves").some
|
||||
private val sortNb = Sort(Descending("nb")).some
|
||||
private def limit(nb: Int) = Limit(nb).some
|
||||
|
||||
|
|
Loading…
Reference in New Issue