Add MMS column

This commit is contained in:
Claude Brisson
2024-07-28 00:29:11 +02:00
parent ecd973dd22
commit 9cee68a489
3 changed files with 32 additions and 16 deletions

View File

@@ -74,6 +74,11 @@ class PairgothTool {
} }
} }
fun getMmsPlayersMap(pairables: Collection<Json.Object>) =
pairables.associate { part ->
Pair(part.getLong("id"), part.getDouble("MMS")?.toLong())
}
fun removeBye(games: Collection<Json.Object>) = fun removeBye(games: Collection<Json.Object>) =
games.filter { games.filter {
it.getInt("b")!! != 0 && it.getInt("w")!! != 0 it.getInt("b")!! != 0 && it.getInt("w")!! != 0

View File

@@ -545,7 +545,7 @@
margin-top: 0.1em !important; margin-top: 0.1em !important;
} }
#header, #logo, #lang, .steps, #filter-box, #reglist-mode, #footer, #unpairables, #pairing-buttons, button, #standings-params, #logout, .pairing-stats, .result-sheets, .toggle, #overview, .tables-exclusion { #header, #logo, #lang, .steps, #filter-box, #reglist-mode, #footer, #unpairables, #pairing-buttons, button, #standings-params, #logout, .pairing-stats, .result-sheets, .toggle, #overview, .tables-exclusion, .button {
display: none !important; display: none !important;
} }

View File

@@ -6,6 +6,26 @@
#set($pmap = $utils.toMap($teams)) #set($pmap = $utils.toMap($teams))
#end #end
## CB TODO - why limit to INDIVIDUAL here?
#if($tour.type == 'INDIVIDUAL' && $tour.pairing.type == 'MAC_MAHON')
#set($mmbase = $api.get("tour/${params.id}/standings/0"))
#if($mmbase.isObject() && ($mmbase.error || $mmbase.message))
#if($mmbase.error)
#set($error = $mmbase.error)
#else
#set($error = $mmbase.message)
#end
<script type="text/javascript">
onLoad(() => {
showError("$error")
});
</script>
#set($mmbase = [])
#end
#set($mmsMap = $utils.getMmsMap($mmbase))
#set($mmsPlayersMap = $utils.getMmsPlayersMap($mmbase))
#end
<div class="tab-content" id="registration-tab"> <div class="tab-content" id="registration-tab">
<div id="reg-view"> <div id="reg-view">
<div id="list-header"> <div id="list-header">
@@ -41,6 +61,9 @@
<th>Rank</th> <th>Rank</th>
## TableSort bug which inverts specified sort... ## TableSort bug which inverts specified sort...
<th data-sort-default="1" aria-sort="ascending">Rating</th> <th data-sort-default="1" aria-sort="ascending">Rating</th>
#if($tour.pairing.type == 'MAC_MAHON')
<th>MMS</th>
#end
<th>Participation</th> <th>Participation</th>
</thead> </thead>
<tbody> <tbody>
@@ -61,6 +84,9 @@
#end #end
<td data-sort="$part.rank">#rank($part.rank)#if($part.mmsCorrection) (#if($part.mmsCorrection > 0)+#end$part.mmsCorrection)#end</td> <td data-sort="$part.rank">#rank($part.rank)#if($part.mmsCorrection) (#if($part.mmsCorrection > 0)+#end$part.mmsCorrection)#end</td>
<td>$part.rating</td> <td>$part.rating</td>
#if($tour.pairing.type == 'MAC_MAHON')
<td>$mmsPlayersMap[$part.id]</td>
#end
<td class="participating" data-sort="#if($part.skip)$part.skip.size()/part.skip#{else}0#end"> <td class="participating" data-sort="#if($part.skip)$part.skip.size()/part.skip#{else}0#end">
<div class="participation"> <div class="participation">
#foreach($round in [1..$tour.rounds]) #foreach($round in [1..$tour.rounds])
@@ -249,21 +275,6 @@
</div> </div>
</div> </div>
#if($tour.type == 'INDIVIDUAL' && $tour.pairing.type == 'MAC_MAHON') #if($tour.type == 'INDIVIDUAL' && $tour.pairing.type == 'MAC_MAHON')
#set($mmbase = $api.get("tour/${params.id}/standings/0"))
#if($mmbase.isObject() && ($mmbase.error || $mmbase.message))
#if($mmbase.error)
#set($error = $mmbase.error)
#else
#set($error = $mmbase.message)
#end
<script type="text/javascript">
onLoad(() => {
showError("$error")
});
</script>
#set($mmbase = [])
#end
#set($mmsMap = $utils.getMmsMap($mmbase))
<div id="macmahon-groups" class="wide popup"> <div id="macmahon-groups" class="wide popup">
<div class="popup-body"> <div class="popup-body">
<div class="popup-content"> <div class="popup-content">