Add an API call and a button to reset all results for a round
This commit is contained in:
@@ -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();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
@@ -39,4 +39,13 @@
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="form-actions">
|
||||
<button id="clear-results" class="ui orange right labeled icon floating info button">
|
||||
<i class="trash icon"></i>
|
||||
Clear results
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div id="confirmation" class="hidden">
|
||||
Clear all results for round <span>$round</span> ?
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user