Rank gives rating if not updated manually before

This commit is contained in:
Claude Brisson
2024-01-30 16:51:38 +01:00
parent 9e3547fbd9
commit 7fd3619382
2 changed files with 12 additions and 3 deletions

View File

@@ -3,6 +3,7 @@ let searchTimer = undefined;
let resultTemplate;
let searchResult;
let searchHighlight;
let manualRating;
function initSearch() {
let needle = $('#needle')[0].value.trim();
@@ -315,6 +316,17 @@ onLoad(() => {
else tr.removeClass('hidden');
});
});
manualRating = ($('#player input[name="rating"]')[0].value !== '');
$('#player input[name="rating"]').on('input', e=>{
manualRating = true;
});
$('#player select[name="rank"]').on('input', e=>{
let rank = e.target.value;
let ratingCtl = $('#player input[name="rating"]')[0];
if (!manualRating) {
ratingCtl.value = 2050 + 100 * rank;
}
});
$('#filter-box i').on('click', e => {
$('#filter')[0].value = '';
$('tbody > tr').removeClass('hidden');
@@ -329,7 +341,6 @@ onLoad(() => {
if (store('macmahonGroups')) {
modal('macmahon-groups');
}
// mac mahon groups...
$('#under-to-top').on('click', e => {
let players = $('#under-group .selected').map(item => (