Merge branch 'translations' of gitlab.jeudego.org:pairgoth/pairgoth into translations

This commit is contained in:
Quentin Rendu
2024-07-22 14:04:09 +02:00
6 changed files with 22 additions and 7 deletions

View File

@@ -132,9 +132,11 @@ sealed class Tournament <P: Pairable>(
if (pivot != null && nextTable == pivot.table) {
++nextTable
}
if (game.table != 0) {
changed = changed || game.table != nextTable
game.table = nextTable++
}
}
return changed
}
@@ -143,7 +145,7 @@ sealed class Tournament <P: Pairable>(
fun stats() = (0..rounds - 1).map { index ->
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),
"games" to (games.getOrNull(index)?.values?.count() ?: 0),
"ready" to (games.getOrNull(index)?.values?.count { it.result != Game.Result.UNKNOWN } ?: 0)

View File

@@ -5,6 +5,8 @@ import java.net.URL
import java.time.LocalDate
import java.time.format.DateTimeFormatter
import java.util.*
import kotlin.math.ceil
import kotlin.math.floor
object EGFRatingsHandler: RatingsHandler(RatingsManager.Ratings.EGF) {
val ratingsDateFormatter = DateTimeFormatter.ofPattern("dd MMM yyyy", Locale.ENGLISH)
@@ -29,7 +31,10 @@ object EGFRatingsHandler: RatingsHandler(RatingsManager.Ratings.EGF) {
player["origin"] = "EGF"
// override rank with rating equivalent
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")) {
player["country"] = "GB"

View File

@@ -57,7 +57,7 @@ class AuthFilter: Filter {
chain.doFilter(req, resp)
} else {
// TODO - protection against brute force attacks
if (uri.endsWith("/index")) {
if (uri.endsWith("/index") && auth == "oauth") {
response.sendRedirect("/index-ffg")
} else {
response.sendRedirect("/login")

View File

@@ -278,4 +278,12 @@ onLoad(() => {
shortName.on('input', e => {
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');
});
});

View File

@@ -4,7 +4,7 @@
<form id="login-form" class="ui form" autocomplete="off">
<div class="field">
<label>Enter the magic word</label>
<input type="text" name="sesame" autocomplete="false"/>
<input type="password" name="sesame" autocomplete="false"/>
<div>&nbsp;</div>
<button type="submit" class="ui green floating button">Log in</button>
</div>

View File

@@ -89,7 +89,7 @@
<div class="four wide field">
<label>Pairing</label>
<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="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>