compute and display irwin status
This commit is contained in:
parent
8ecf7e7d7b
commit
1ee599f7a3
|
@ -237,7 +237,7 @@ object User extends LilaController {
|
|||
Env.plan.api.recentChargesOf(user) zip
|
||||
Env.report.api.byAndAbout(user, 20) zip
|
||||
Env.pref.api.getPref(user) zip
|
||||
Env.irwin.api.reports.withPovs(user) zip
|
||||
Env.irwin.api.status(user) zip
|
||||
Env.user.noteApi.forMod(user.id) flatMap {
|
||||
case emails ~ spy ~ assess ~ history ~ charges ~ reports ~ pref ~ irwin ~ notes =>
|
||||
(Env.playban.api bans spy.usersSharingIp.map(_.id)) zip
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
@(report: lila.irwin.IrwinReport.WithPovs)(implicit ctx: Context)
|
||||
@(report: lila.irwin.IrwinReport.WithPovs, request: Option[lila.irwin.IrwinRequest])(implicit ctx: Context)
|
||||
|
||||
@percentClass(percent: Int) = { @percent match {
|
||||
case p if p < 30 => {green}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
@(u: User, emails: User.Emails, spy: lila.security.UserSpy, optionAggregateAssessment: Option[lila.evaluation.PlayerAggregateAssessment.WithGames], bans: Map[String, Int], history: List[lila.mod.Modlog], charges: List[lila.plan.Charge], reports: lila.report.Report.ByAndAbout, pref: lila.pref.Pref, irwinReport: Option[lila.irwin.IrwinReport.WithPovs], notes: List[lila.user.Note])(implicit ctx: Context)
|
||||
@(u: User, emails: User.Emails, spy: lila.security.UserSpy, optionAggregateAssessment: Option[lila.evaluation.PlayerAggregateAssessment.WithGames], bans: Map[String, Int], history: List[lila.mod.Modlog], charges: List[lila.plan.Charge], reports: lila.report.Report.ByAndAbout, pref: lila.pref.Pref, irwinStatus: lila.irwin.IrwinStatus, notes: List[lila.user.Note])(implicit ctx: Context)
|
||||
|
||||
@import lila.evaluation.Display
|
||||
@import lila.pref.Pref
|
||||
|
@ -87,11 +87,16 @@
|
|||
<strong class="text inline" data-icon="%">Notable preferences:</strong>
|
||||
@if(pref.keyboardMove != Pref.KeyboardMove.NO) { [keyboard moves] } else { none }
|
||||
</div>
|
||||
@irwinReport.map { report =>
|
||||
@irwinStatus.report.map { report =>
|
||||
<div class="irwin">
|
||||
<strong class="text" data-icon="">Irwin report:</strong>
|
||||
@views.html.mod.irwinReport(report)
|
||||
@views.html.mod.irwinReport(report, irwinStatus.request)
|
||||
</div>
|
||||
}.getOrElse {
|
||||
@irwinStatus.request.map { request =>
|
||||
<strong class="text" data-icon="">Irwin request:</strong>
|
||||
in progress, requested @momentFromNow(request.createdAt) by: @request.origin
|
||||
}
|
||||
}
|
||||
@optionAggregateAssessment.fold{
|
||||
<div class="evaluation">
|
||||
|
|
|
@ -15,6 +15,9 @@ final class IrwinApi(
|
|||
|
||||
import BSONHandlers._
|
||||
|
||||
def status(user: User): Fu[IrwinStatus] =
|
||||
reports.withPovs(user) zip requests.get(user.id) map { (IrwinStatus.apply _).tupled }
|
||||
|
||||
object reports {
|
||||
|
||||
def insert(report: IrwinReport) =
|
||||
|
|
|
@ -17,6 +17,8 @@ case class IrwinReport(
|
|||
def userId = _id
|
||||
}
|
||||
|
||||
case class IrwinStatus(report: Option[IrwinReport.WithPovs], request: Option[IrwinRequest])
|
||||
|
||||
object IrwinReport {
|
||||
|
||||
case class GameReport(
|
||||
|
|
Loading…
Reference in a new issue