Various bugfixes for teams support

This commit is contained in:
Claude Brisson
2024-04-15 19:50:45 +02:00
parent 179a502bbc
commit 23a4ae37b2
8 changed files with 22 additions and 11 deletions

View File

@@ -117,7 +117,7 @@ onLoad(()=>{
});
$('#pair').on('click', e => {
let parts = $('#pairables .selected.listitem').map(item => parseInt(item.data("id")));
if (parts.length) {
if (parts.length === 0) {
$('#pairables .listitem').addClass('selected');
parts = $('#pairables .selected.listitem').map(item => parseInt(item.data("id")));
}

View File

@@ -13,10 +13,14 @@ function split(teams) {
let promises = teams.map(team => api.deleteJson(`tour/${tour_id}/team/${team}`));
Promise.all(promises)
.then(rsts => {
let all = true;
let any = false;
for (let rst of rsts) {
all = all && rst.success;
any = any || rst.success;
if (!rst.success) console.error(rst.error)
}
document.location.reload();
if (any) document.location.reload();
});
}
@@ -28,6 +32,10 @@ onLoad(() => {
});
$('#split').on('click', e => {
let rows = $('#teams .selected.listitem')
if (rows.length == 0) {
$('#teams .listitem').addClass('selected');
rows = $('#teams .selected.listitem');
}
let teams = rows.map(item => parseInt(item.data("id")));
if (teams.length !== 0) split(teams);
});

View File

@@ -63,9 +63,9 @@
<select name="type">
<option value="INDIVIDUAL" #if(!$tour || $tour.type == 'INDIVIDUAL') selected #end>Individual players</option>
<option value="PAIRGO" #if($tour && $tour.type == 'PAIRGO') selected #end>Pair-go tournament</option>
#* TODO
<option value="RENGO2" #if($tour && $tour.type == 'RENGO2') selected #end>Rengo with 2 players teams</option>
<option value="RENGO3" #if($tour && $tour.type == 'RENGO3') selected #end>Rengo with 3 players team</option>
#* TODO
<option value="TEAM2" #if($tour && $tour.type == 'TEAM2') selected #end>Team of 2 individual players</option>
<option value="TEAM3" #if($tour && $tour.type == 'TEAM3') selected #end>Team of 3 individual players</option>
<option value="TEAM4" #if($tour && $tour.type == 'TEAM4') selected #end>Team of 4 individual players</option>