{{ define "title" }}{{ .Championship.Name }}{{ end }} {{ define "content" }}
{{ $championship := .Championship }} {{ $entrants := .Championship.AllEntrants }} {{ $writeAccess := WriteAccess }} {{ $eventInProgress := .EventInProgress }}

{{ $championship.Name }}

{{ if $championship.SignUpForm.Enabled }}
Register to this Championship
You can register for a place in this Championship! {{ if $championship.SignUpForm.RequiresApproval }} Pending admin approval, you will be added to the grid! {{ end }} Register Now
{{ end }} {{ if gt $championship.Progress 0.0 }}
{{ int $championship.Progress }}%
{{ end }}
{{ if gt $championship.Progress 0.0 }}
{{ if $championship.IsMultiClass }}{{ end }} {{ if $championship.HasTeamNames }} {{ end }} {{ if WriteAccess }} {{ end }} {{ range $classIndex, $class := $championship.Classes }} {{ $entrants := ($class.Standings $championship.Events) }} {{ range $i, $entrant := $entrants }} {{ if $championship.IsMultiClass }} {{ if eq $i 0 }} {{ end }} {{ end }} {{ if $championship.HasTeamNames }} {{ end }} {{ if WriteAccess }} {{ end }} {{ end }} {{ end }}
Class# DriverTeamPointsActions
{{ $class.Name }}{{ add $i 1 }} {{ driverName $entrant.Car.Driver.Name }} {{ $driverPenalty := $class.PenaltyForGUID $entrant.Car.Driver.GUID }} {{ if gt $driverPenalty 0 }} Points Penalty: {{ $driverPenalty }} {{ end }} {{ $entrant.TeamSummary }}{{ $entrant.Points }}
{{ if $championship.IsMultiClass }}{{ end }} {{ if WriteAccess }} {{ end }} {{ range $classIndex, $class := $championship.Classes }} {{ $teamStandings := ($class.TeamStandings $championship.Events) }} {{ range $i, $team := $teamStandings }} {{ if $championship.IsMultiClass }} {{ if eq $i 0 }} {{ end }} {{ end }} {{ if WriteAccess }} {{ end }} {{ end }} {{ end }}
Class# Team PointsActions
{{ $class.Name }}{{ add $i 1 }} {{ $team.Team }} {{ $teamPenalty := $class.PenaltyForTeam $team.Team }} {{ if gt $teamPenalty 0 }} Points Penalty: {{ $teamPenalty }} {{ end }} {{ $team.Points }}
{{ else }}
{{ if $championship.IsMultiClass }}{{ end }} {{ if $championship.HasTeamNames }} {{ end }} {{ range $classIndex, $class := $championship.Classes }} {{ $entrants := $class.Entrants.PrettyList }} {{ range $i, $entrant := $entrants }} {{ if ne $entrant.GUID "OPEN_SLOTS" }} {{ if $championship.IsMultiClass }} {{ if eq $i 0 }} {{ end }} {{ end }} {{ if $championship.HasTeamNames }} {{ end }} {{ else }} {{ if $championship.OpenEntrants }} {{ if $championship.IsMultiClass }} {{ end }} {{ end }} {{ end }} {{ end }} {{ end }}
Class# DriverTeamCar
{{ $class.Name }}{{ add $i 1 }} {{ driverName $entrant.Name }}{{ $entrant.Team }}{{ prettify $entrant.Model true }}
{{ $class.Name }} {{ $entrant.Name }}
{{ end }}
{{ if $championship.IsMultiClass }}{{ end }} {{ range $classIndex, $class := $championship.Classes }} {{ range $i, $pts := $class.Points.Places }} {{ if $championship.IsMultiClass }} {{ if eq $i 0 }} {{ end }} {{ end }} {{ end }} {{ end }}
ClassPlace Points
{{ $class.Name }}{{ add $i 1 }}{{ ordinal (add $i 1) }} {{ $pts }}
Fastest Race Lap {{ $class.Points.BestLap }}
Best Qualifying Lap {{ $class.Points.PolePosition }}
Second Race Points Multiplier {{ $class.Points.SecondRaceMultiplier }}
{{ if gt $championship.Progress 0.0 }}
{{ range $classIndex, $class := $championship.Classes }} {{ $entrants := ($class.Standings $championship.Events) }} {{ range $i, $entrant := $entrants }}
Car Skin
{{ if $championship.IsMultiClass }} {{ $class.Name }}
{{ end }} {{ add $i 1 }}{{ ordinal (add $i 1) }} Place

{{ driverName $entrant.Car.Driver.Name }}
{{ $entrant.Car.Driver.Team }}

{{ end }} {{ end }}
{{ end }}
{{ with $championship.Info }}
{{ $championship.Info }}


{{ end }}
{{ if $writeAccess }} Add more Events {{ end }}

Events

This Championship currently has {{ len $championship.Events }} events configured.

{{ range $eventIndex, $event := $championship.Events }} {{ $eventSetup := $event.RaceSetup }}
{{ $trackInfo := trackInfo $eventSetup.Track $eventSetup.TrackLayout }} {{ with $trackInfo }} {{ .Name }}{{ with .Country }}, {{ . }}{{ end }} {{ else }} {{ prettify $eventSetup.Track false }} {{ with $eventSetup.TrackLayout }}({{ prettify . true }}){{ end }} {{ end }} in {{ carList ($event.Cars $championship) }}
{{ if $event.Completed }} Complete {{ else if $event.InProgress }} In Progress {{ else if isBefore .Scheduled }} Scheduled for {{ localFormat .Scheduled }} {{ else }} Not started {{ end }}
    {{ range $sessionName, $session := $eventSetup.Sessions }}
  • {{ if and $eventSetup.HasMultipleRaces (eq $sessionName "RACE") }} 1st {{ end }} {{ $sessionName.String }} : {{ if ne $session.Time 0 }} {{ $session.Time }} minutes {{ else }} {{ with $session.Laps }} {{ . }} laps {{ end }} {{ end }}
  • {{ end }} {{ if $eventSetup.HasMultipleRaces }} {{ $session := index $eventSetup.Sessions (SessionType "RACE") }}
  • 2nd Race: {{ if ne $session.Time 0 }} {{ $session.Time }} minutes {{ else }} {{ with $session.Laps }} {{ . }} laps {{ end }} {{ end }}
    {{ if eq $eventSetup.ReversedGridRacePositions -1 }} All grid positions will be reversed in 2nd Race. {{ else if eq $eventSetup.ReversedGridRacePositions 1 }} A 2nd Race will take place with the grid formed from the 1st Race's results. {{ else }} {{ $eventSetup.ReversedGridRacePositions }} grid positions will be reversed in 2nd Race. {{ end }}
  • {{ end }}
{{ if $event.Completed }}
{{ if $eventSetup.HasMultipleRaces }}
1st Race
{{ end }}
    {{ if $championship.IsMultiClass }} {{ range $classIndex, $class := $championship.Classes }} {{ range $sessionName, $sessionDetails := $event.Sessions }} {{ if eq $sessionName "RACE" }} {{ range $pos, $result := (slice ($class.ResultsForClass $sessionDetails.Results.Result) 0 1) }} {{ with $result }}
  • {{ $class.Name }} Winner
    {{ driverName $result.DriverName }}
  • {{ end }} {{ end }} {{ end }} {{ end }} {{ end }} {{ else }} {{ range $sessionName, $sessionDetails := $event.Sessions }} {{ with $sessionDetails.Results }} {{ if eq $sessionName "RACE" }} {{ range $pos, $result := (slice $sessionDetails.Results.Result 0 3) }} {{ with $result }} {{ if gt $result.TotalTime 0 }} {{ $posInt := int64 (add $pos 1) }}
  • {{ $posInt }}{{ ordinal $posInt }}: {{ driverName $result.DriverName }}
  • {{ end }} {{ end }} {{ end }} {{ end }} {{ end }} {{ end }} {{ end }}
{{ if $eventSetup.HasMultipleRaces }}
2nd Race
    {{ if $championship.IsMultiClass }} {{ range $classIndex, $class := $championship.Classes }} {{ range $sessionName, $sessionDetails := $event.Sessions }} {{ if eq $sessionName "RACEx2" }} {{ range $pos, $result := (slice ($class.ResultsForClass $sessionDetails.Results.Result) 0 1) }}
  • {{ $class.Name }} Winner
    {{ driverName $result.DriverName }}
  • {{ end }} {{ end }} {{ end }} {{ end }} {{ else }} {{ range $sessionName, $sessionDetails := $event.Sessions }} {{ if eq $sessionName "RACEx2" }} {{ range $pos, $result := (slice $sessionDetails.Results.Result 0 3) }} {{ with $result }} {{ if gt $result.TotalTime 0 }} {{ $posInt := int64 (add $pos 1) }}
  • {{ $posInt }}{{ ordinal $posInt }}: {{ driverName $result.DriverName }}
  • {{ end }} {{ end }} {{ end }} {{ end }} {{ end }} {{ end }}
{{ end }}
{{ end }}
{{/* fastest lap + qualifying awards */}} {{ range $sessionName, $session := $event.Sessions }} {{ with $session.Results }} {{ if eq $sessionName "RACE" }} Fastest Lap{{ if $eventSetup.HasMultipleRaces }} (1st Race){{ end }} : {{ driverName $session.Results.FastestLap.DriverName }}
{{ else if eq $sessionName "RACEx2" }} Fastest Lap (2nd Race) : {{ driverName $session.Results.FastestLap.DriverName }}
{{ else if eq $sessionName "QUALIFY" }} Best Qualifying: {{ driverName $session.Results.FastestLap.DriverName }}
{{ end }} {{ end }} {{ end }}
{{/* race controls buttons */}}
{{ if $writeAccess }} {{ if not (or $event.InProgress $event.Completed) }} {{ if $eventInProgress }}

An event in this championship is in progress. You must wait for it to finish or cancel it before you can start this one.

{{ end }} Start Event Start Practice Event {{ else if $event.InProgress }} Restart Event Cancel Event {{ end }} {{ end }} {{ if $event.Completed }} {{ if AdminAccess }} {{ end }} {{ end }}
{{ $eventSetup.Track }} {{ $eventSetup.TrackLayout }}
{{ if (or $event.InProgress $event.Completed) }}
{{ $sessionCount = 1 }} {{ range $sessionName, $sessionDetails := $event.Sessions }}
{{ if $sessionDetails.Completed }}

View detailed results breakdown for this Session

{{ template "session-overall" $sessionDetails.Results }} {{ else if $sessionDetails.InProgress }}

Session in Progress: Looks like there aren't any results yet. Check back later.

{{ else }}

Awaiting Start: Looks like this session hasn't started yet. Check back later.

{{ end }}
{{ $sessionCount = add $sessionCount 1 }} {{ end }} {{ if $event.Completed }}
{{ if $championship.IsMultiClass }} {{ end }} {{ range $classIndex, $class := $championship.Classes }} {{ $eventStandings := $class.StandingsForEvent $event }} {{ range $pos, $standing := $eventStandings }} {{ if $championship.IsMultiClass }} {{ if eq $pos 0 }} {{ end }} {{ end }} {{ end }} {{ end }}
Class# Name Team Car Points
{{ $class.Name }}{{ add $pos 1 }} {{ driverName $standing.Car.Driver.Name }} {{ $standing.Car.Driver.Team }} {{ prettify $standing.Car.Model true }} {{ $standing.Points }}
{{ end }}
{{ end }}
{{ end }}
{{ end }}