Always send rating in hook form - fixes #10115

deepcrayonfish^2
Benedikt Werner 2021-11-14 16:37:37 +01:00
parent e343d23e7e
commit ca28dd450a
No known key found for this signature in database
GPG Key ID: 1DBFF0F8E9E121EB
1 changed files with 17 additions and 7 deletions

View File

@ -167,14 +167,24 @@ object forms {
div(cls := "ratings")(
form3.hidden("rating", "?"),
lila.rating.PerfType.nonPuzzle.map { perfType =>
div(cls := perfType.key)(
trans.perfRatingX(
raw(s"""<strong data-icon="${perfType.iconChar}">${ctx.pref.showRatings ?? me
.perfs(perfType.key)
.map(_.intRating.toString)
.getOrElse("?")}</strong> ${perfType.trans}""")
{
val rating = me
.perfs(perfType.key)
.map(_.intRating.toString)
.getOrElse("?")
div(cls := perfType.key)(
if (ctx.pref.showRatings)
trans.perfRatingX(
raw(s"""<strong data-icon="${perfType.iconChar}">${rating}</strong> ${perfType.trans}""")
)
else
frag(
i(dataIcon := perfType.iconChar),
strong(cls := "none")(rating), // To calculate rating range in JS
perfType.trans
)
)
)
}
}
)
}