View team on registration page ; review code of constraints on teams updates
This commit is contained in:
@@ -17,6 +17,14 @@ import kotlin.io.path.walk
|
||||
class PairgothTool {
|
||||
fun toMap(array: Json.Array) = array.map { ser -> ser as Json.Object }.associateBy { it.getLong("id")!! }
|
||||
|
||||
fun getTeamMap(array: Json.Array) = array.flatMap { ser -> (ser as Json.Object).getArray("players")!!.map { Pair(it, ser.getLong("id")!!) } }.toMap()
|
||||
|
||||
fun truncate(disp: String?, length: Int): String {
|
||||
if (disp == null) return ""
|
||||
if (disp.length <= length) return disp
|
||||
return disp.substring(0, length) + "…"
|
||||
}
|
||||
|
||||
fun countFinals(array: Json.Array) = array.map { ser -> ser as Json.Object }.count { it.getBoolean("final") ?: false }
|
||||
|
||||
fun getCriteria() = mapOf(
|
||||
|
@@ -32,13 +32,13 @@
|
||||
</div>
|
||||
<div id="pairing-lists">
|
||||
<div id="pairing-left">
|
||||
<div id="pairables" class="multi-select" title="pairable players">
|
||||
<div id="pairables" class="multi-select" title="pairable #if($tour.type == 'INDIVIDUAL')players#{else}teams#end">
|
||||
#foreach($p in $pairables)
|
||||
#set($part = $pmap[$p])
|
||||
<div data-id="$part.id" class="listitem pairable"><span class="name">$part.name#if($part.firstname) $part.firstname#end</span><span>#rank($part.rank)#if($part.country) $part.country#end</span></div>
|
||||
#end
|
||||
</div>
|
||||
<div id="unpairables" class="multi-select" title="unpairable players">
|
||||
<div id="unpairables" class="multi-select" title="unpairable #if($tour.type == 'INDIVIDUAL')players#{else}teams#end">
|
||||
#foreach($p in $unpairables)
|
||||
#set($part = $pmap[$p])
|
||||
<div data-id="$part.id" class="listitem unpairable"><span class="name">$part.name#if($part.firstname) $part.firstname#end</span><span>#rank($part.rank)#if($part.country) $part.country#end</span></div>
|
||||
|
@@ -6,6 +6,7 @@
|
||||
## Pairgo, rengo and teams of individuals
|
||||
#set($teams = $api.get("tour/${params.id}/team"))
|
||||
#set($pmap = $utils.toMap($teams))
|
||||
#set($tmap = $utils.getTeamMap($teams))
|
||||
#end
|
||||
|
||||
## Team players do not have an individual MMS
|
||||
@@ -66,6 +67,9 @@
|
||||
<th data-sort-default="1" aria-sort="ascending">Rating</th>
|
||||
#if($tour.type == 'INDIVIDUAL' && $tour.pairing.type == 'MAC_MAHON')
|
||||
<th>MMS</th>
|
||||
#end
|
||||
#if($tour.type != 'INDIVIDUAL')
|
||||
<th>Team</th>
|
||||
#end
|
||||
<th>Participation</th>
|
||||
</thead>
|
||||
@@ -91,6 +95,15 @@
|
||||
<td>$part.rating</td>
|
||||
#if($tour.type == 'INDIVIDUAL' && $tour.pairing.type == 'MAC_MAHON')
|
||||
<td>$!mmsPlayersMap[$part.id]</td>
|
||||
#end
|
||||
#if($tour.type != 'INDIVIDUAL')
|
||||
#set($teamId = $tmap[$part.id])
|
||||
#if($teamId)
|
||||
#set($teamName = $!pmap[$teamId].name)
|
||||
#end
|
||||
<td title="$esc.html($teamName)">
|
||||
$esc.html($utils.truncate($!teamName, 10))
|
||||
</td>
|
||||
#end
|
||||
<td class="participating" data-sort="#if($part.skip)$part.skip.size()/part.skip#{else}0#end">
|
||||
<div class="participation">
|
||||
|
Reference in New Issue
Block a user