Table renumbering ; various bugfixes and enhancements
This commit is contained in:
@@ -45,4 +45,17 @@ class PairgothTool {
|
||||
"SDC" to "Simplified direct confrontation", // Simplified direct confrontation
|
||||
"DC" to "Direct confrontation", // Direct confrontation
|
||||
)
|
||||
|
||||
fun getResultsStats(games: Collection<Json.Object>): Json.Object {
|
||||
var total = 0
|
||||
var known = 0
|
||||
games
|
||||
.filter{ it.getInt("b")!! != 0 && it.getInt("w")!! != 0 }
|
||||
.map { it -> it.getString("r") }
|
||||
.forEach {
|
||||
++total
|
||||
if ("?" != it) ++known
|
||||
}
|
||||
return Json.Object("total" to total, "known" to known)
|
||||
}
|
||||
}
|
@@ -425,6 +425,9 @@
|
||||
font-size: 1rem !important;
|
||||
line-height: 1.1rem !important;
|
||||
min-width: 60vw;
|
||||
&::before {
|
||||
top: 0;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -145,5 +145,6 @@ the configuration guide le guide de configuration
|
||||
to à
|
||||
unpairable players joueurs non disponibles
|
||||
version 0.1 supports the version 0.1 supporte le système d’appariement
|
||||
white blanc
|
||||
white vs. black blanc vs. Noir
|
||||
confirmed. confirmé(s).
|
@@ -1,4 +1,4 @@
|
||||
function setResult(id, result) {
|
||||
function setResult(id, result, previous) {
|
||||
api.putJson(`tour/${tour_id}/res/${activeRound}`, { id: id, result: result })
|
||||
.then(res => {
|
||||
if (res !== 'error') {
|
||||
@@ -19,6 +19,16 @@ function setResult(id, result) {
|
||||
let resultCell = row.find('td.result');
|
||||
resultCell.text(dispResult).data('result', result);
|
||||
standingsUpToDate = false;
|
||||
|
||||
if (previous === '?') {
|
||||
let indicator = $('#known')[0];
|
||||
let known = parseInt(indicator.innerText);
|
||||
indicator.innerText = ++known;
|
||||
} else if (result === '?') {
|
||||
let indicator = $('#known')[0];
|
||||
let known = parseInt(indicator.innerText);
|
||||
indicator.innerText = --known;
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -36,9 +46,9 @@ onLoad(()=>{
|
||||
$('#results-table .result').on('click', e => {
|
||||
let cell = e.target.closest('.result');
|
||||
let gameId = e.target.closest('tr').data('id');
|
||||
let result = cell.data('result');
|
||||
let index = results.indexOf(result);
|
||||
result = results[(index + 1)%results.length];
|
||||
setResult(gameId, result);
|
||||
let oldResult = cell.data('result');
|
||||
let index = results.indexOf(oldResult);
|
||||
let newResult = results[(index + 1)%results.length];
|
||||
setResult(gameId, newResult, oldResult);
|
||||
});
|
||||
});
|
||||
|
@@ -4,6 +4,8 @@
|
||||
<button class="ui floating choose-round prev-round button">«</button>
|
||||
<span class="active-round">$round</span>
|
||||
<button class="ui floating choose-round next-round button">»</button>
|
||||
#set($stats = $utils.getResultsStats($games))
|
||||
<span class="norbeak"><span id="known">$stats.known</span> / $stats.total</span>
|
||||
</div>
|
||||
<div id="results-list" class="roundbox">
|
||||
<table id="results-table" class="ui celled striped table">
|
||||
@@ -23,7 +25,7 @@
|
||||
<td>#$game.t</td>
|
||||
<td class="white player #if($game.r == 'w' || $game.r == '#') winner #elseif($game.r == 'b' || $game.r == '0') looser #end" data-id="$white.id" data-sort="$white.name $white.firstname"><span>#if($white)$white.name $white.firstname #rank($white.rank)#{else}BIP#end</span></td>
|
||||
<td class="black player #if($game.r == 'b' || $game.r == '#') winner #elseif($game.r == 'w' || $game.r == '0') looser #end" data-id="$black.id" data-sort="$black.name $black.firstname"><span>#if($black)$black.name $black.firstname #rank($black.rank)#{else}BIP#end</span></td>
|
||||
<td class="result centered" data-result="$game.r">$dispRst[$game.r]</td>
|
||||
<td class="result centered" data-sort="$game.r" data-result="$game.r">$dispRst[$game.r]</td>
|
||||
</tr>
|
||||
#end
|
||||
#end
|
||||
|
Reference in New Issue
Block a user