less confusing elo range validation

This commit is contained in:
Thibault Duplessis 2013-06-10 12:55:30 +02:00
parent b14a04ed19
commit d10d7c0694
3 changed files with 8 additions and 4 deletions

View file

@ -7,7 +7,7 @@ import controllers.routes
trait AssetHelper {
val assetVersion = 56
val assetVersion = 57
def cssTag(name: String) = css("stylesheets/" + name)

View file

@ -1761,7 +1761,10 @@ var lichess_sri = Math.random().toString(36).substring(5); // 8 chars
var $formTag = $form.find('form');
function ajaxSubmit(color) {
if ($form.find('.elo_range_config span.invalid').length) return false;
if ($form.find('.elo_range_config span.invalid').length) {
alert('The Elo range is invalid.');
return false;
}
$.ajax({
url: $formTag.attr('action').replace(/uid-placeholder/, lichess_sri),
data: $formTag.serialize() + "&color=" + color,
@ -1813,7 +1816,7 @@ var lichess_sri = Math.random().toString(36).substring(5); // 8 chars
function isInvalid(values) {
var vmin = parseInt(values[0]);
var vmax = parseInt(values[1]);
return vmin > myElo || vmax < myElo || (vmax - vmin < 200);
return vmin > (myElo + 200) || vmax < (myElo - 200) || (vmax - vmin < 200);
}
$span.text(values.join(' - ')).toggleClass('invalid', isInvalid(values));
$this.slider({

3
todo
View file

@ -65,10 +65,11 @@ no time data http://en.lichess.org/x9tls3mh/stats
second realtime board on homepage (right)
show friend games in homepage board
allow to filter anon
add fast tooltips to plots
replace plot with watch plot when game starts
real rematch against AI
lobby table sort
fix elo range
graph grid
---