diff --git a/api-webapp/src/main/kotlin/org/jeudego/pairgoth/model/Tournament.kt b/api-webapp/src/main/kotlin/org/jeudego/pairgoth/model/Tournament.kt index 2ee8fa9..f1b0c5e 100644 --- a/api-webapp/src/main/kotlin/org/jeudego/pairgoth/model/Tournament.kt +++ b/api-webapp/src/main/kotlin/org/jeudego/pairgoth/model/Tournament.kt @@ -132,8 +132,10 @@ sealed class Tournament ( if (pivot != null && nextTable == pivot.table) { ++nextTable } - changed = changed || game.table != nextTable - game.table = nextTable++ + if (game.table != 0) { + changed = changed || game.table != nextTable + game.table = nextTable++ + } } return changed } @@ -143,7 +145,7 @@ sealed class Tournament ( 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) diff --git a/view-webapp/src/main/kotlin/org/jeudego/pairgoth/ratings/EGFRatingsHandler.kt b/view-webapp/src/main/kotlin/org/jeudego/pairgoth/ratings/EGFRatingsHandler.kt index bb6abbf..fafb97b 100644 --- a/view-webapp/src/main/kotlin/org/jeudego/pairgoth/ratings/EGFRatingsHandler.kt +++ b/view-webapp/src/main/kotlin/org/jeudego/pairgoth/ratings/EGFRatingsHandler.kt @@ -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" diff --git a/view-webapp/src/main/kotlin/org/jeudego/pairgoth/web/AuthFilter.kt b/view-webapp/src/main/kotlin/org/jeudego/pairgoth/web/AuthFilter.kt index befb42c..05246a1 100644 --- a/view-webapp/src/main/kotlin/org/jeudego/pairgoth/web/AuthFilter.kt +++ b/view-webapp/src/main/kotlin/org/jeudego/pairgoth/web/AuthFilter.kt @@ -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") diff --git a/view-webapp/src/main/webapp/js/tour-information.inc.js b/view-webapp/src/main/webapp/js/tour-information.inc.js index 1f43858..a009703 100644 --- a/view-webapp/src/main/webapp/js/tour-information.inc.js +++ b/view-webapp/src/main/webapp/js/tour-information.inc.js @@ -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'); + }); }); diff --git a/view-webapp/src/main/webapp/login.html b/view-webapp/src/main/webapp/login.html index bed6087..78dc0c4 100644 --- a/view-webapp/src/main/webapp/login.html +++ b/view-webapp/src/main/webapp/login.html @@ -4,7 +4,7 @@
- +
 
diff --git a/view-webapp/src/main/webapp/tour-information.inc.html b/view-webapp/src/main/webapp/tour-information.inc.html index b7a43aa..9571549 100644 --- a/view-webapp/src/main/webapp/tour-information.inc.html +++ b/view-webapp/src/main/webapp/tour-information.inc.html @@ -89,7 +89,7 @@
- ## TODO