Review automatic rating/rank calculations
This commit is contained in:
@@ -3,7 +3,8 @@ let searchTimer = undefined;
|
|||||||
let resultTemplate;
|
let resultTemplate;
|
||||||
let searchResult;
|
let searchResult;
|
||||||
let searchHighlight;
|
let searchHighlight;
|
||||||
let manualRating;
|
let manualRating = false;
|
||||||
|
let manualRank = false;
|
||||||
|
|
||||||
function initSearch() {
|
function initSearch() {
|
||||||
let needle = $('#needle')[0].value.trim();
|
let needle = $('#needle')[0].value.trim();
|
||||||
@@ -16,7 +17,7 @@ function initSearch() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function searchResultShown() {
|
function searchResultShown() {
|
||||||
return !(!searchResult || !searchResult.length)
|
return !(!searchResult || searchResult.length === 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
function search(needle) {
|
function search(needle) {
|
||||||
@@ -111,7 +112,7 @@ function addPlayers() {
|
|||||||
['countryFilter', /* 'aga', */ 'egf', 'ffg'].forEach(id => {
|
['countryFilter', /* 'aga', */ 'egf', 'ffg'].forEach(id => {
|
||||||
let value = store(id);
|
let value = store(id);
|
||||||
let ctl = $(`#${id}`);
|
let ctl = $(`#${id}`);
|
||||||
if (value !== null && typeof(value) !== 'undefined' && ctl.length) {
|
if (value !== null && typeof(value) !== 'undefined' && ctl.length !== 0) {
|
||||||
ctl[0].checked = value;
|
ctl[0].checked = value;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -287,7 +288,7 @@ onLoad(() => {
|
|||||||
if (searchFormState) {
|
if (searchFormState) {
|
||||||
for (let id of ["countryFilter", /* "aga", */ "egf", "ffg"]) {
|
for (let id of ["countryFilter", /* "aga", */ "egf", "ffg"]) {
|
||||||
let ctl = $(`#${id}`);
|
let ctl = $(`#${id}`);
|
||||||
if (ctl.length) {
|
if (ctl.length !== 0) {
|
||||||
ctl[0].checked = searchFormState[id];
|
ctl[0].checked = searchFormState[id];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -384,14 +385,15 @@ onLoad(() => {
|
|||||||
else tr.removeClass('hidden');
|
else tr.removeClass('hidden');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
manualRating = ($('#player input[name="rating"]')[0].value !== '');
|
manualRating = ($('#rating')[0].value !== '');
|
||||||
|
manualRank = ($('#rank')[0].value !== '');
|
||||||
$('#player input[name="rating"]').on('input', e=>{
|
$('#player input[name="rating"]').on('input', e=>{
|
||||||
manualRating = true;
|
manualRating = true;
|
||||||
});
|
});
|
||||||
$('#player select[name="rank"]').on('input', e=>{
|
$('#player select[name="rank"]').on('input', e=>{
|
||||||
let rank = e.target.value;
|
let rank = e.target.value;
|
||||||
let ratingCtl = $('#player input[name="rating"]')[0];
|
let ratingCtl = $('#player input[name="rating"]')[0];
|
||||||
if (!manualRating) {
|
if (!$('#rating')[0].value || !manualRating) {
|
||||||
ratingCtl.value = 2050 + 100 * rank;
|
ratingCtl.value = 2050 + 100 * rank;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -414,7 +416,7 @@ onLoad(() => {
|
|||||||
let scrollIntoView = store('scrollIntoView');
|
let scrollIntoView = store('scrollIntoView');
|
||||||
if (scrollIntoView) {
|
if (scrollIntoView) {
|
||||||
let row = $(`tr[data-id="${scrollIntoView}"`);
|
let row = $(`tr[data-id="${scrollIntoView}"`);
|
||||||
if (row.length) {
|
if (row.length !== 0) {
|
||||||
row.addClass('highlighted');
|
row.addClass('highlighted');
|
||||||
store.remove('scroll');
|
store.remove('scroll');
|
||||||
setTimeout(()=>{
|
setTimeout(()=>{
|
||||||
@@ -494,4 +496,15 @@ onLoad(() => {
|
|||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
$('#rating').on('input', e => {
|
||||||
|
if (!$('#rank')[0].value || !manualRank) {
|
||||||
|
let rank = (e.target.value - 2050) / 100;
|
||||||
|
console.log(rank);
|
||||||
|
$('#rank')[0].value = `${rank}`;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
$('#rank').on('input', e => {
|
||||||
|
manualRank = true;
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@@ -3,7 +3,6 @@
|
|||||||
#set($pmap = $utils.toMap($parts))
|
#set($pmap = $utils.toMap($parts))
|
||||||
#else
|
#else
|
||||||
#set($teams = $api.get("tour/${params.id}/team"))
|
#set($teams = $api.get("tour/${params.id}/team"))
|
||||||
$log.debug("@@@@@@@@@ teams = $teams")
|
|
||||||
#set($pmap = $utils.toMap($teams))
|
#set($pmap = $utils.toMap($teams))
|
||||||
#end
|
#end
|
||||||
|
|
||||||
@@ -99,7 +98,7 @@
|
|||||||
<form id="search-form" class="ui edit form">
|
<form id="search-form" class="ui edit form">
|
||||||
<div id="search-header" class="five stackable fields">
|
<div id="search-header" class="five stackable fields">
|
||||||
#if($tour.country)
|
#if($tour.country)
|
||||||
<div class="two wide field">
|
<div class="two wide centered field">
|
||||||
<div class="toggle">
|
<div class="toggle">
|
||||||
<input id="countryFilter" name="countryFilter" type="checkbox" value="$tour.country"/>
|
<input id="countryFilter" name="countryFilter" type="checkbox" value="$tour.country"/>
|
||||||
<div class="search-param checkbox">
|
<div class="search-param checkbox">
|
||||||
@@ -116,7 +115,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
#* Disabled
|
#* Disabled
|
||||||
<div class="two wide field">
|
<div class="two wide centered field">
|
||||||
<div class="toggle">
|
<div class="toggle">
|
||||||
<input id="aga" name="aga" type="checkbox" value="true"/>
|
<input id="aga" name="aga" type="checkbox" value="true"/>
|
||||||
<div class="search-param checkbox">
|
<div class="search-param checkbox">
|
||||||
@@ -126,7 +125,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
*#
|
*#
|
||||||
<div class="two wide field">
|
<div class="two wide centered field">
|
||||||
<div class="toggle" title="${utils.ratingsDates.egf|'no egf ratings'}">
|
<div class="toggle" title="${utils.ratingsDates.egf|'no egf ratings'}">
|
||||||
<input id="egf" name="egf" type="checkbox" checked value="true"/>
|
<input id="egf" name="egf" type="checkbox" checked value="true"/>
|
||||||
<div class="search-param checkbox">
|
<div class="search-param checkbox">
|
||||||
@@ -135,7 +134,7 @@
|
|||||||
<label>EGF</label>
|
<label>EGF</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="two wide field">
|
<div class="two wide centered field">
|
||||||
<div class="toggle" title="${utils.ratingsDates.ffg|'no ffg ratings'}">
|
<div class="toggle" title="${utils.ratingsDates.ffg|'no ffg ratings'}">
|
||||||
<input id="ffg" name="ffg" type="checkbox" checked value="true"/>
|
<input id="ffg" name="ffg" type="checkbox" checked value="true"/>
|
||||||
<div class="search-param checkbox">
|
<div class="search-param checkbox">
|
||||||
@@ -195,12 +194,12 @@
|
|||||||
<div class="eight wide field">
|
<div class="eight wide field">
|
||||||
<label>Rating</label>
|
<label>Rating</label>
|
||||||
<span class="info"></span>
|
<span class="info"></span>
|
||||||
<input name="rating" type="text" class="numeric"/>
|
<input id="rating" name="rating" type="text" class="numeric"/>
|
||||||
</div>
|
</div>
|
||||||
<div class="eight wide field">
|
<div class="eight wide field">
|
||||||
<label>Rank<span class="note">initialized from rating</span></label>
|
<label>Rank<span class="note">initialized from rating</span></label>
|
||||||
<span class="info"></span>
|
<span class="info"></span>
|
||||||
<select name="rank">
|
<select id="rank" name="rank">
|
||||||
<option></option>
|
<option></option>
|
||||||
#levels()
|
#levels()
|
||||||
</select>
|
</select>
|
||||||
|
Reference in New Issue
Block a user