rename puzzle fields
This commit is contained in:
parent
1db2d9e662
commit
47861bc852
|
@ -16,8 +16,8 @@ object JsData extends lila.Steroids {
|
|||
"puzzleId" -> a.puzzleId,
|
||||
"date" -> a.date,
|
||||
"win" -> a.win,
|
||||
"userRating" -> a.userRating,
|
||||
"userRatingDiff" -> a.userRatingDiff)
|
||||
"rating" -> a.rating,
|
||||
"ratingDiff" -> a.ratingDiff)
|
||||
})
|
||||
|
||||
def apply(
|
||||
|
@ -66,7 +66,7 @@ object JsData extends lila.Steroids {
|
|||
"mode" -> mode,
|
||||
"round" -> round.map { a =>
|
||||
Json.obj(
|
||||
"userRatingDiff" -> a.userRatingDiff,
|
||||
"ratingDiff" -> a.ratingDiff,
|
||||
"win" -> a.win
|
||||
)
|
||||
},
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
<tr>
|
||||
<td>
|
||||
<a class="user_link ulpt" href="@routes.User.show(userInfos.user.username)">
|
||||
@userInfos.user.username (@attempt.userRating) @showRatingDiff(attempt.userRatingDiff)
|
||||
@userInfos.user.username (@attempt.rating) @showRatingDiff(attempt.ratingDiff)
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
|
|
|
@ -28,8 +28,8 @@ private[puzzle] final class Finisher(
|
|||
userId = user.id,
|
||||
date = DateTime.now,
|
||||
win = data.isWin,
|
||||
userRating = user.perfs.puzzle.intRating,
|
||||
userRatingDiff = userPerf.intRating - user.perfs.puzzle.intRating)
|
||||
rating = user.perfs.puzzle.intRating,
|
||||
ratingDiff = userPerf.intRating - user.perfs.puzzle.intRating)
|
||||
(api.learning.update(user, puzzle, data) >> (api.round add a) >> {
|
||||
puzzleColl.update(
|
||||
$id(puzzle.id),
|
||||
|
@ -43,8 +43,8 @@ private[puzzle] final class Finisher(
|
|||
userId = user.id,
|
||||
date = DateTime.now,
|
||||
win = data.isWin,
|
||||
userRating = user.perfs.puzzle.intRating,
|
||||
userRatingDiff = 0)
|
||||
rating = user.perfs.puzzle.intRating,
|
||||
ratingDiff = 0)
|
||||
fuccess(a -> data.isWin.some)
|
||||
}
|
||||
|
||||
|
|
|
@ -9,12 +9,12 @@ case class Round(
|
|||
userId: User.ID,
|
||||
date: DateTime,
|
||||
win: Boolean,
|
||||
userRating: Int,
|
||||
userRatingDiff: Int) {
|
||||
rating: Int,
|
||||
ratingDiff: Int) {
|
||||
|
||||
def loss = !win
|
||||
|
||||
def userPostRating = userRating + userRatingDiff
|
||||
def userPostRating = rating + ratingDiff
|
||||
}
|
||||
|
||||
object Round {
|
||||
|
@ -24,8 +24,8 @@ object Round {
|
|||
val userId = "u"
|
||||
val date = "d"
|
||||
val win = "w"
|
||||
val userRating = "ur"
|
||||
val userRatingDiff = "ud"
|
||||
val rating = "r"
|
||||
val ratingDiff = "d"
|
||||
}
|
||||
|
||||
import reactivemongo.bson._
|
||||
|
@ -40,15 +40,15 @@ object Round {
|
|||
userId = r str userId,
|
||||
date = r.get[DateTime](date),
|
||||
win = r bool win,
|
||||
userRating = r int userRating,
|
||||
userRatingDiff = r int userRatingDiff)
|
||||
rating = r int rating,
|
||||
ratingDiff = r int ratingDiff)
|
||||
|
||||
def writes(w: BSON.Writer, o: Round) = BSONDocument(
|
||||
puzzleId -> o.puzzleId,
|
||||
userId -> o.userId,
|
||||
date -> o.date,
|
||||
win -> o.win,
|
||||
userRating -> w.int(o.userRating),
|
||||
userRatingDiff -> w.int(o.userRatingDiff))
|
||||
rating -> w.int(o.rating),
|
||||
ratingDiff -> w.int(o.ratingDiff))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -87,7 +87,7 @@ function renderWin(ctrl, round) {
|
|||
return m('div.comment.win', [
|
||||
m('h3.text[data-icon=E]', [
|
||||
m('strong', ctrl.trans('victory')),
|
||||
round ? renderRatingDiff(round.userRatingDiff) : null
|
||||
round ? renderRatingDiff(round.ratingDiff) : null
|
||||
])
|
||||
]);
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ function renderLoss(ctrl, round) {
|
|||
return m('div.comment.loss',
|
||||
m('h3.text[data-icon=k]', [
|
||||
m('strong', ctrl.trans('puzzleFailed')),
|
||||
round ? renderRatingDiff(round.userRatingDiff) : null
|
||||
round ? renderRatingDiff(round.ratingDiff) : null
|
||||
])
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue