Merge branch 'master' into translations
This commit is contained in:
@@ -132,9 +132,11 @@ sealed class Tournament <P: Pairable>(
|
|||||||
if (pivot != null && nextTable == pivot.table) {
|
if (pivot != null && nextTable == pivot.table) {
|
||||||
++nextTable
|
++nextTable
|
||||||
}
|
}
|
||||||
|
if (game.table != 0) {
|
||||||
changed = changed || game.table != nextTable
|
changed = changed || game.table != nextTable
|
||||||
game.table = nextTable++
|
game.table = nextTable++
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return changed
|
return changed
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -143,7 +145,7 @@ sealed class Tournament <P: Pairable>(
|
|||||||
|
|
||||||
fun stats() = (0..rounds - 1).map { index ->
|
fun stats() = (0..rounds - 1).map { index ->
|
||||||
Json.Object(
|
Json.Object(
|
||||||
"participants" to pairables.values.count { !it.skip.contains(index + 1) },
|
"participants" to pairables.values.count { it.final && !it.skip.contains(index + 1) },
|
||||||
"paired" to (games.getOrNull(index)?.values?.flatMap { listOf(it.black, it.white) }?.count { it != 0 } ?: 0),
|
"paired" to (games.getOrNull(index)?.values?.flatMap { listOf(it.black, it.white) }?.count { it != 0 } ?: 0),
|
||||||
"games" to (games.getOrNull(index)?.values?.count() ?: 0),
|
"games" to (games.getOrNull(index)?.values?.count() ?: 0),
|
||||||
"ready" to (games.getOrNull(index)?.values?.count { it.result != Game.Result.UNKNOWN } ?: 0)
|
"ready" to (games.getOrNull(index)?.values?.count { it.result != Game.Result.UNKNOWN } ?: 0)
|
||||||
|
@@ -5,6 +5,8 @@ import java.net.URL
|
|||||||
import java.time.LocalDate
|
import java.time.LocalDate
|
||||||
import java.time.format.DateTimeFormatter
|
import java.time.format.DateTimeFormatter
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
import kotlin.math.ceil
|
||||||
|
import kotlin.math.floor
|
||||||
|
|
||||||
object EGFRatingsHandler: RatingsHandler(RatingsManager.Ratings.EGF) {
|
object EGFRatingsHandler: RatingsHandler(RatingsManager.Ratings.EGF) {
|
||||||
val ratingsDateFormatter = DateTimeFormatter.ofPattern("dd MMM yyyy", Locale.ENGLISH)
|
val ratingsDateFormatter = DateTimeFormatter.ofPattern("dd MMM yyyy", Locale.ENGLISH)
|
||||||
@@ -29,7 +31,10 @@ object EGFRatingsHandler: RatingsHandler(RatingsManager.Ratings.EGF) {
|
|||||||
player["origin"] = "EGF"
|
player["origin"] = "EGF"
|
||||||
// override rank with rating equivalent
|
// override rank with rating equivalent
|
||||||
player["rating"]?.toString()?.toIntOrNull()?.let { rating ->
|
player["rating"]?.toString()?.toIntOrNull()?.let { rating ->
|
||||||
player["rank"] = ((rating - 2050)/100).let { if (it < 0) "${-it+1}k" else "${it+1}d" }
|
val adjusted = rating - 2050;
|
||||||
|
player["rank"] =
|
||||||
|
if (adjusted < 0) "${-(adjusted - 99) / 100}k"
|
||||||
|
else "${(adjusted + 100) / 100}d"
|
||||||
}
|
}
|
||||||
if ("UK" == player.getString("country")) {
|
if ("UK" == player.getString("country")) {
|
||||||
player["country"] = "GB"
|
player["country"] = "GB"
|
||||||
|
@@ -57,7 +57,7 @@ class AuthFilter: Filter {
|
|||||||
chain.doFilter(req, resp)
|
chain.doFilter(req, resp)
|
||||||
} else {
|
} else {
|
||||||
// TODO - protection against brute force attacks
|
// TODO - protection against brute force attacks
|
||||||
if (uri.endsWith("/index")) {
|
if (uri.endsWith("/index") && auth == "oauth") {
|
||||||
response.sendRedirect("/index-ffg")
|
response.sendRedirect("/index-ffg")
|
||||||
} else {
|
} else {
|
||||||
response.sendRedirect("/login")
|
response.sendRedirect("/login")
|
||||||
|
@@ -278,4 +278,12 @@ onLoad(() => {
|
|||||||
shortName.on('input', e => {
|
shortName.on('input', e => {
|
||||||
manualShortName = true;
|
manualShortName = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('select[name="pairing"]').on('change', e => {
|
||||||
|
let pairing = e.target.value.toLowerCase();
|
||||||
|
if (pairing === 'mms') $('#tournament-infos .mms').removeClass('hidden');
|
||||||
|
else $('#tournament-infos .mms').addClass('hidden');
|
||||||
|
if (pairing === 'swiss') $('#tournament-infos .swiss').removeClass('hidden');
|
||||||
|
else $('#tournament-infos .swiss').addClass('hidden');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
<form id="login-form" class="ui form" autocomplete="off">
|
<form id="login-form" class="ui form" autocomplete="off">
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label>Enter the magic word</label>
|
<label>Enter the magic word</label>
|
||||||
<input type="text" name="sesame" autocomplete="false"/>
|
<input type="password" name="sesame" autocomplete="false"/>
|
||||||
<div> </div>
|
<div> </div>
|
||||||
<button type="submit" class="ui green floating button">Log in</button>
|
<button type="submit" class="ui green floating button">Log in</button>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -89,7 +89,7 @@
|
|||||||
<div class="four wide field">
|
<div class="four wide field">
|
||||||
<label>Pairing</label>
|
<label>Pairing</label>
|
||||||
<span class="info"></span>
|
<span class="info"></span>
|
||||||
<select name="pairing">
|
<select name="pairing" #if($tour)disabled#end>
|
||||||
<option value="MAC_MAHON" #if(!$tour || $tour.pairing.type == 'MAC_MAHON') selected #end>Mac Mahon</option>
|
<option value="MAC_MAHON" #if(!$tour || $tour.pairing.type == 'MAC_MAHON') selected #end>Mac Mahon</option>
|
||||||
<option value="SWISS" #if($tour && $tour.pairing.type == 'SWISS') selected #end>Swiss</option>
|
<option value="SWISS" #if($tour && $tour.pairing.type == 'SWISS') selected #end>Swiss</option>
|
||||||
## TODO <option value="ROUND_ROBIN" #if($tour && $tour.pairing.type == 'ROUND_ROBIN') selected #end>Round-robin</option>
|
## TODO <option value="ROUND_ROBIN" #if($tour && $tour.pairing.type == 'ROUND_ROBIN') selected #end>Round-robin</option>
|
||||||
|
Reference in New Issue
Block a user