Keep the user consistent when browsing a crosstable.
This mostly works, however the crosstable user-order is inconsistent in at least one place. I will investigate this further.
This commit is contained in:
parent
4c196a2e5d
commit
5e5ffc656f
|
@ -137,8 +137,17 @@ object Round extends LilaController with TheftPrevention {
|
|||
def watcher(gameId: String, color: String) = Open { implicit ctx =>
|
||||
GameRepo.pov(gameId, color) flatMap {
|
||||
case Some(pov) =>
|
||||
get("pov") match {
|
||||
case Some(povUsername) => (pov.player.userId, pov.opponent.userId) match {
|
||||
case (Some(x),Some(y)) if y == povUsername => Redirect(routes.Round.watcher(gameId, (!pov.color).name)).fuccess
|
||||
case (Some(x),Some(y)) if x == povUsername => Redirect(routes.Round.watcher(gameId, pov.color.name)).fuccess
|
||||
case _ => notFound
|
||||
}
|
||||
case None => {
|
||||
env.checkOutoftime(pov.game)
|
||||
watch(pov)
|
||||
}
|
||||
}
|
||||
case None => Challenge showId gameId
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
case (r, index) => {
|
||||
<td @if(currentId.??(r.gameId==)){class="current"}>
|
||||
<a
|
||||
href="@routes.Round.watcher(r.gameId, "white")"
|
||||
href="@routes.Round.watcher(r.gameId, "white")?pov=@crosstable.user1.id"
|
||||
class="glpt @r.winnerId match {
|
||||
case Some(w) if w == u.id => { win }
|
||||
case None => {}
|
||||
|
|
Loading…
Reference in a new issue