Table numbers exclusion: handle saving

This commit is contained in:
Claude Brisson
2024-07-27 15:53:41 +02:00
parent 02e1fb8319
commit 6e97c91b2f
5 changed files with 77 additions and 26 deletions

View File

@@ -1,12 +1,31 @@
let focused = undefined;
function pair(parts) {
api.postJson(`tour/${tour_id}/pair/${activeRound}`, parts)
.then(rst => {
if (rst !== 'error') {
document.location.reload();
}
});
let doWork = () => {
api.postJson(`tour/${tour_id}/pair/${activeRound}`, parts)
.then(rst => {
if (rst !== 'error') {
document.location.reload();
}
});
}
let tablesExclusionControl = $('#exclude-tables');
let value = tablesExclusionControl[0].value;
let origValue = tablesExclusionControl.data('orig');
if (value === origValue) {
// tables exclusion value did not change
doWork();
} else {
// tables exclusion value has change, we must save it first
api.putJson(`tour/${tour_id}`, { round: activeRound, excludeTables: value })
.then(rst => {
if (rst !== 'error') {
doWork();
}
});
}
}
function unpair(games) {