<commit_before>package views.html.game

import play.twirl.api.Html

import controllers.routes
import lila.api.Context
import lila.app.templating.Environment._
import lila.game.Crosstable

object crosstable {

  def apply(ct: Crosstable.WithMatchup, currentId: Option[String])(implicit ctx: Context): Html =
    apply(ct.crosstable, ct.matchup, currentId)(ctx)

  def apply(ct: Crosstable, matchup: Option[Crosstable.Matchup], currentId: Option[String])(implicit ctx: Context): Html = Html {

    val users = ct.users.toList.map { u =>

      val fill = ct.fill.map { i =>
        s"""<td${if (i == 20) " class=\"last\"" else ""}><a>&nbsp;</a></td>"""
      } mkString ""

      val results = ct.results.zipWithIndex.map {
        case (r, i) =>
          val href = s"""${routes.Round.watcher(r.gameId, "white")}?pov=${u.id}"""
          val (klass, text) = r.winnerId match {
            case Some(w) if w == u.id => "glpt win" -> "1"
            case None => "glpt" -> "½"
            case _ => "glpt loss" -> "0"
          }
          val link = s"""<a href="$href" class="$klass">$text</a>"""
          s"""<td${if (currentId contains r.gameId) " class=\"current\"" else ""}>$link</td>"""
      } mkString ""

      val score = s"""<th class="score${ct.users.winnerId.fold("")(w => if (w == u.id) " win" else " loss")}">${ct.showScore(u.id)}</th>"""

      val user = s"""<th class="user">${userIdLink(u.id.some, withOnline = false)}</th>"""

      val matchScore = matchup ?? { m =>
        s"""<th class="matchup${m.users.winnerId.fold("")(w => if (w == u.id) " win" else " loss")}">${m.users.showScore(u.id)}</th>"""
      }

      s"""<tr>$fill$results$score$user$matchScore</tr>"""
<commit_msg>only display matchup score if different than lifetime<commit_after>package views.html.game

import play.twirl.api.Html

import controllers.routes
import lila.api.Context
import lila.app.templating.Environment._
import lila.game.Crosstable

object crosstable {

  def apply(ct: Crosstable.WithMatchup, currentId: Option[String])(implicit ctx: Context): Html =
    apply(ct.crosstable, ct.matchup, currentId)(ctx)

  def apply(ct: Crosstable, trueMatchup: Option[Crosstable.Matchup], currentId: Option[String])(implicit ctx: Context): Html = Html {

    val matchup = trueMatchup.filter(_.users.nbGames != ct.users.nbGames)

    val users = ct.users.toList.map { u =>

      val fill = ct.fill.map { i =>
        s"""<td${if (i == 20) " class=\"last\"" else ""}><a>&nbsp;</a></td>"""
      } mkString ""

      val results = ct.results.zipWithIndex.map {
        case (r, i) =>
          val href = s"""${routes.Round.watcher(r.gameId, "white")}?pov=${u.id}"""
          val (klass, text) = r.winnerId match {
            case Some(w) if w == u.id => "glpt win" -> "1"
            case None => "glpt" -> "½"
            case _ => "glpt loss" -> "0"
          }
          val link = s"""<a href="$href" class="$klass">$text</a>"""
          s"""<td${if (currentId contains r.gameId) " class=\"current\"" else ""}>$link</td>"""
      } mkString ""

      val score = s"""<th class="score${ct.users.winnerId.fold("")(w => if (w == u.id) " win" else " loss")}">${ct.showScore(u.id)}</th>"""

      val user = s"""<th class="user">${userIdLink(u.id.some, withOnline = false)}</th>"""

      val matchScore = matchup ?? { m =>
        s"""<th class="matchup${m.users.winnerId.fold("")(w => if (w == u.id) " win" else " loss")}">${m.users.showScore(u.id)}</th>"""
      }

      s"""<tr>$fill$results$score$user$matchScore</tr>"""

{'fraction_non_alphanumeric': 0.2099290780141844, 'fraction_numerical': 0.0022695035460992908, 'mean_word_length': 3.043577981651376, 'pattern_counts': {'":': 0, '<': 35, '<?xml version=': 0, '>': 59, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2622886', 'n_tokens_mistral': 1281, 'n_tokens_neox': 1244, 'n_words': 259}