Back to Frontend

CricketMatchSummary.Scala

sport/app/cricket/views/fragments/cricketMatchSummary.scala.html

latest1.2 KB
Original Source

@import java.time.format.DateTimeFormatter @import java.time.ZoneId @import common.LinkTo @import common.Chronos @import views.support.GuDateFormatLegacy @(theMatch: cricketModel.Match, matchUrl: String)(implicit request: RequestHeader)

@GuDateFormatLegacy(Chronos.javaTimeLocalDateTimeToJodaDateTime(theMatch.gameDate), "d MMM y") @theMatch.competitionName, @theMatch.venueName

| Team name | Score | @teamResults(theMatch.homeTeam, theMatch.homeTeamInnings) @teamResults(theMatch.awayTeam, theMatch.awayTeamInnings) @theMatch.competitionName, @theMatch.venueName | View full scorecard |

@teamResults(team: cricketModel.Team, teamInnings: List[cricketModel.Innings]) = { | @team.name | @teamInnings match { case firstInnings :: Nil => { @score(firstInnings) (@firstInnings.overs overs) } case firstInnings :: secondInnings :: Nil => { @score(firstInnings) & @score(secondInnings) (@secondInnings.overs overs) } case _ => { Yet to bat } } | } @score(innings: cricketModel.Innings) = { @innings.runsScored @innings match { case _ if innings.declared => { - @innings.wickets declared } case _ if innings.forfeited => { - @innings.wickets forfeited } case _ if innings.allOut => { all out } case _ => { - @innings.wickets } } }