Files
pairgoth/view-webapp/src/main/webapp/result-sheets.html
2025-10-08 20:14:20 +02:00

70 lines
1.6 KiB
HTML

#macro(rank $rank)#if( $rank<0 )#set( $k = -$rank )${k}k#else#set( $d=$rank+1 )${d}d#end#end
#if (!$tour)
<div class="section">
<h2 class="error">Invalid tournament id</h2>
</div>
#stop
#end
#set($round = $math.toInteger($!params.round))
#if(!$round)
#set($round = 1)
#else
#set($round = $math.min($math.max($round, 1), $tour.rounds))
#end
<div class="section">
#if($tour.type == 'INDIVIDUAL' || $tour.type.startsWith('TEAM'))
#set($parts = $api.get("tour/${params.id}/part"))
#else
#set($parts = $api.get("tour/${params.id}/team"))
#end
#set($pmap = $utils.toMap($parts))
#set($roundPairing = $api.get("tour/${params.id}/pair/$round"))
#if($roundPairing.error)
<script type="text/javascript">
onLoad(() => {
showError("$roundPairing.error")
});
</script>
#stop
#end
#set($games = $utils.removeBye($roundPairing.games))
<table>
<tr>
<th>Table</th>
<th>Black</th>
<th>Rank</th>
<th>White</th>
<th>Rank</th>
<th>Handicap</th>
<th>Komi</th>
</tr>
#set($numOfPlay = $games.size() - 1)
#foreach($i in [0..$numOfPlay])
#set($game = $games[$i])
#set($white = $pmap[$game.w])
#set($black = $pmap[$game.b])
#set($komi = $tour.komi)
#if($game.h) #set($komi = $komi - $math.floor($komi)) #end
#set($table = $i + 1)
<tr>
<td>Table $table</td>
<td>$black.name $!black.firstname</td>
<td>#rank($black.rank)</td>
<td>$white.name $!white.firstname</td>
<td>#rank($white.rank)</td>
<td>$game.h</td>
<td>$komi</td>
</tr>
#end
</table>
</div>
<script type="text/javascript">
onLoad(() => {
window.print();
});
</script>