Add an API call and a button to reset all results for a round

This commit is contained in:
Claude Brisson
2024-06-13 20:00:52 +02:00
parent 0fd9f6e27a
commit f7d42c399c
5 changed files with 41 additions and 1 deletions

View File

@@ -41,6 +41,15 @@ function setResult(id, result, previous) {
})
}
function clearResults() {
api.deleteJson(`tour/${tour_id}/res/${activeRound}`)
.then(res => {
if (res !== 'error') {
document.location.reload();
}
})
}
const results = [ '?', 'w', 'b', '=', 'X', '#', '0' ];
onLoad(()=>{
@@ -70,4 +79,9 @@ onLoad(()=>{
$('#results-table tbody tr').removeClass('filtered');
}
});
$('#clear-results').on('click', e => {
if (confirm($('#confirmation')[0].textContent)) {
clearResults();
}
});
});