Add config options to enable/disable and show/hide egf & ffg ratings; choose ffg defaults after tournament country
This commit is contained in:
@@ -85,3 +85,35 @@ Logging configuration.
|
|||||||
logger.level = info
|
logger.level = info
|
||||||
logger.format = [%level] %ip [%logger] %message
|
logger.format = [%level] %ip [%logger] %message
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## ratings
|
||||||
|
|
||||||
|
Ratings configuration. `<ratings>` stands for `egf` or `ffg` in the following.
|
||||||
|
|
||||||
|
### freeze ratings date
|
||||||
|
|
||||||
|
If the following property is given:
|
||||||
|
|
||||||
|
```
|
||||||
|
ratings.<ratings>.file = ...
|
||||||
|
```
|
||||||
|
|
||||||
|
then the given ratings file will be used (it must use the Pairgoth ratings json format). If not, the corresponding ratings will be automatically downloaded and stored into `ratings/EGF-yyyymmdd.json` or `ratings/FFG-yyyymmdd.json`.
|
||||||
|
|
||||||
|
The typical use case, for a big tournament lasting several days or a congress, is to let Pairgoth download the latest expected ratings, then to add this property to freeze the ratings at a specific date.
|
||||||
|
|
||||||
|
### enable or disable ratings
|
||||||
|
|
||||||
|
Whether to display the EGF or FFG ratings button in the Add Player popup:
|
||||||
|
|
||||||
|
```
|
||||||
|
ratings.<ratings>.enable = true | false
|
||||||
|
```
|
||||||
|
|
||||||
|
Whether to show the ratings player IDs on the registration page:
|
||||||
|
|
||||||
|
```
|
||||||
|
ratings.<ratings>.show = true | false
|
||||||
|
```
|
||||||
|
|
||||||
|
For a tournament in France, both are true for `ffg` by default, false otherwise.
|
||||||
|
@@ -2,6 +2,7 @@ package org.jeudego.pairgoth.view
|
|||||||
|
|
||||||
import com.republicate.kson.Json
|
import com.republicate.kson.Json
|
||||||
import org.jeudego.pairgoth.ratings.RatingsManager
|
import org.jeudego.pairgoth.ratings.RatingsManager
|
||||||
|
import org.jeudego.pairgoth.web.WebappManager
|
||||||
import java.nio.file.Files
|
import java.nio.file.Files
|
||||||
import java.nio.file.Path
|
import java.nio.file.Path
|
||||||
import java.nio.file.Paths
|
import java.nio.file.Paths
|
||||||
@@ -110,4 +111,8 @@ class PairgothTool {
|
|||||||
}.toSet()
|
}.toSet()
|
||||||
return players.filter { p -> !teamed.contains(p.getLong("id")) }
|
return players.filter { p -> !teamed.contains(p.getLong("id")) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// EGF ratings
|
||||||
|
fun displayRatings(ratings: String, country: String): Boolean = WebappManager.properties.getProperty("ratings.${ratings}.enable")?.toBoolean() ?: (ratings.lowercase() != "ffg") || country.lowercase() == "fr"
|
||||||
|
fun showRatings(ratings: String, country: String): Boolean = WebappManager.properties.getProperty("ratings.${ratings}.enable")?.toBoolean() ?: (ratings.lowercase() != "ffg") || country.lowercase() == "fr"
|
||||||
}
|
}
|
@@ -53,11 +53,12 @@
|
|||||||
<th>First name</th>
|
<th>First name</th>
|
||||||
<th>Country</th>
|
<th>Country</th>
|
||||||
<th>Club</th>
|
<th>Club</th>
|
||||||
##if($tour.country == 'FR')
|
#if($utils.showRatings('egf', $tour.country.toLowerCase()))
|
||||||
## <th>FFG</th>
|
|
||||||
##else
|
|
||||||
<th>PIN</th>
|
<th>PIN</th>
|
||||||
##end
|
#end
|
||||||
|
#if($utils.showRatings('ffg', $tour.country.toLowerCase()))
|
||||||
|
<th>FFG</th>
|
||||||
|
#end
|
||||||
<th>Rank</th>
|
<th>Rank</th>
|
||||||
## TableSort bug which inverts specified sort...
|
## TableSort bug which inverts specified sort...
|
||||||
<th data-sort-default="1" aria-sort="ascending">Rating</th>
|
<th data-sort-default="1" aria-sort="ascending">Rating</th>
|
||||||
@@ -77,11 +78,12 @@
|
|||||||
<td>$part.firstname</td>
|
<td>$part.firstname</td>
|
||||||
<td>$part.country.toUpperCase()</td>
|
<td>$part.country.toUpperCase()</td>
|
||||||
<td>$part.club</td>
|
<td>$part.club</td>
|
||||||
#if($tour.country == 'FR')
|
#if($utils.showRatings('egf', $tour.country.toLowerCase()))
|
||||||
<td>$!part.ffg</td>
|
|
||||||
#else
|
|
||||||
<td>$!part.egf </td>
|
<td>$!part.egf </td>
|
||||||
#end
|
#end
|
||||||
|
#if($utils.showRatings('ffg', $tour.country.toLowerCase()))
|
||||||
|
<td>$!part.ffg</td>
|
||||||
|
#end
|
||||||
## display MMS correction on the screen, but not when printed
|
## display MMS correction on the screen, but not when printed
|
||||||
<td data-sort="$part.rank">#rank($part.rank)#if($part.mmsCorrection)<span class="noprint"> (#if($part.mmsCorrection > 0)+#end$part.mmsCorrection)</span>#end</td>
|
<td data-sort="$part.rank">#rank($part.rank)#if($part.mmsCorrection)<span class="noprint"> (#if($part.mmsCorrection > 0)+#end$part.mmsCorrection)</span>#end</td>
|
||||||
<td>$part.rating</td>
|
<td>$part.rating</td>
|
||||||
@@ -135,7 +137,15 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
#end
|
#end
|
||||||
<div class="needle eight wide field">
|
#set($needleWidth = 12)
|
||||||
|
#if($utils.displayRatings('egf', $tour.country.toLowerCase()))
|
||||||
|
#set($needleWidth = $needleWidth - 2)
|
||||||
|
#end
|
||||||
|
#if($utils.displayRatings('ffg', $tour.country.toLowerCase()))
|
||||||
|
#set($needleWidth = $needleWidth - 2)
|
||||||
|
#end
|
||||||
|
#set($cssWidth = { 8: 'eight', 10: 'ten', 12: 'twelve' })
|
||||||
|
<div class="needle $cssWidth[$needleWidth] wide field">
|
||||||
<div class="ui icon input">
|
<div class="ui icon input">
|
||||||
<input id="needle" name="needle" type="text" placeholder="Search..." spellcheck="false">
|
<input id="needle" name="needle" type="text" placeholder="Search..." spellcheck="false">
|
||||||
<i id="clear-search" class="clickable close icon"></i>
|
<i id="clear-search" class="clickable close icon"></i>
|
||||||
@@ -152,6 +162,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
*#
|
*#
|
||||||
|
#if($utils.displayRatings('egf', $tour.country.toLowerCase()))
|
||||||
<div class="two wide centered 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"/>
|
||||||
@@ -161,6 +172,8 @@
|
|||||||
<label>EGF</label>
|
<label>EGF</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
#end
|
||||||
|
#if($utils.displayRatings('ffg', $tour.country.toLowerCase()))
|
||||||
<div class="two wide centered 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"/>
|
||||||
@@ -170,8 +183,9 @@
|
|||||||
<label>FFG</label>
|
<label>FFG</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
#end
|
||||||
<div class="two wide centered field">
|
<div class="two wide centered field">
|
||||||
<div class="toggle" title="${utils.ratingsDates.ffg|'no ffg ratings'}">
|
<div class="toggle" title="browse">
|
||||||
<input id="browse" name="browse" type="checkbox" value="true"/>
|
<input id="browse" name="browse" type="checkbox" value="true"/>
|
||||||
<div class="search-param checkbox">
|
<div class="search-param checkbox">
|
||||||
<div class="circle"></div>
|
<div class="circle"></div>
|
||||||
|
Reference in New Issue
Block a user