Fix rounding option: correct choice is 'round down' or 'no rounding'
This commit is contained in:
@@ -15,6 +15,7 @@ import kotlin.math.ceil
|
||||
import kotlin.math.floor
|
||||
import kotlin.math.max
|
||||
import kotlin.math.min
|
||||
import kotlin.math.round
|
||||
|
||||
// TODO CB avoid code redundancy with solvers
|
||||
|
||||
@@ -29,7 +30,7 @@ fun Tournament<*>.getSortedPairables(round: Int, includePreliminary: Boolean = f
|
||||
val epsilon = 0.00001
|
||||
// Note: this works for now because we only have .0 and .5 fractional parts
|
||||
return if (pairing.pairingParams.main.roundDownScore) floor(score + epsilon)
|
||||
else ceil(score - epsilon)
|
||||
else round(2 * score) / 2
|
||||
}
|
||||
|
||||
if (frozen != null) {
|
||||
@@ -45,7 +46,7 @@ fun Tournament<*>.getSortedPairables(round: Int, includePreliminary: Boolean = f
|
||||
val score = roundScore(mmBase +
|
||||
(nbW(pairable) ?: 0.0) +
|
||||
(1..round).map { round ->
|
||||
if (playersPerRound.getOrNull(round - 1)?.contains(pairable.id) == true) 0 else 1
|
||||
if (playersPerRound.getOrNull(round - 1)?.contains(pairable.id) == true) 0.0 else 1.0
|
||||
}.sum() * pairing.pairingParams.main.mmsValueAbsent)
|
||||
Pair(
|
||||
if (pairing.pairingParams.main.sosValueAbsentUseBase) mmBase
|
||||
@@ -96,7 +97,7 @@ fun Tournament<*>.getSortedPairables(round: Int, includePreliminary: Boolean = f
|
||||
val pairables = pairables.values.filter { includePreliminary || it.final }.map { it.toDetailedJson() }
|
||||
pairables.forEach { player ->
|
||||
for (crit in criteria) {
|
||||
player[crit.first] = (crit.second[player.getID()] ?: 0.0).toInt()
|
||||
player[crit.first] = crit.second[player.getID()] ?: 0.0
|
||||
}
|
||||
player["results"] = Json.MutableArray(List(round) { "0=" })
|
||||
}
|
||||
|
@@ -48,7 +48,7 @@ abstract class BasePairingHelper(
|
||||
// Decide each pairable group based on the main criterion
|
||||
protected val groupsCount get() = 1 + (mainLimits.second - mainLimits.first).toInt()
|
||||
private val _groups by lazy {
|
||||
pairables.associate { pairable -> Pair(pairable.id, pairable.main.toInt()) }
|
||||
pairables.associate { pairable -> Pair(pairable.id, (pairable.main * 2).toInt() / 2) }
|
||||
}
|
||||
|
||||
// place (among sorted pairables)
|
||||
|
@@ -480,7 +480,7 @@ sealed class BaseSolver(
|
||||
val epsilon = 0.00001
|
||||
// Note: this works for now because we only have .0 and .5 fractional parts
|
||||
return if (pairing.main.roundDownScore) floor(score + epsilon)
|
||||
else ceil(score - epsilon)
|
||||
else round(2 * score) / 2
|
||||
}
|
||||
|
||||
open fun HandicapParams.clamp(input: Int): Int {
|
||||
|
@@ -5,6 +5,7 @@
|
||||
<tool key="translate" class="org.jeudego.pairgoth.view.TranslationTool"/>
|
||||
<tool key="strings" class="org.apache.commons.lang3.StringUtils"/>
|
||||
<tool key="utils" class="org.jeudego.pairgoth.view.PairgothTool"/>
|
||||
<tool key="number" locale="en_US"/>
|
||||
<!--
|
||||
<tool key="number" format="#0.00"/>
|
||||
<tool key="date" locale="fr_FR" format="yyyy-MM-dd"/>
|
||||
|
@@ -204,3 +204,4 @@ Pairgoth mailing list liste de diffusion Pairgoth
|
||||
to be notified about updates and to discuss the software. pour être mis au courant des mises à jour et pour discuter du logiciel.
|
||||
(give us a star if you have a github account!) (donnez-nous une étoile si vous avez un compte github !)
|
||||
Clear results Effacer les résultats
|
||||
round down NBW/MMS score arrondir le score NBW/MMS à l'entier inférieur
|
||||
|
@@ -256,3 +256,4 @@ rather than pairing players of the same country. 점 차이를 선호
|
||||
rather than pairing players of the same club. 동일 클럽 선수끼리 매칭하는 것보다 3점 차이를 선호
|
||||
use MMS rather than rank for handicap 핸디캡에는 랭킹 대신 MMS 사용
|
||||
Handicap ceiling: 핸디캡 상한:
|
||||
round down NBW/MMS score 라운드 내림 라운드 NBW/MMS
|
||||
|
@@ -14,14 +14,7 @@
|
||||
#if($tour.pairing.type == 'MAC_MAHON')
|
||||
<div class="inline fields">
|
||||
<div class="field">
|
||||
<label>
|
||||
Round
|
||||
<select name="roundDownScore">
|
||||
<option value="true" #if($tour.pairing.main.roundDownScore) selected #end>down</option>
|
||||
<option value="false" #if(!$tour.pairing.main.roundDownScore) selected #end>up</option>
|
||||
</select>
|
||||
NBW/MMS score
|
||||
</label>
|
||||
<label><input type="checkbox" name="roundDownScore" value="true" #if($tour.pairing.main.roundDownScore) checked #end> round down NBW/MMS score</label>
|
||||
</div>
|
||||
</div>
|
||||
#end
|
||||
|
@@ -97,7 +97,8 @@
|
||||
<td class="nobreak game-result" #if($opponent)title="$esc.html($opponent.name)#if($opponent.firstname) $esc.html($opponent.firstname)#end #rank($opponent.rank)#if($opponent.country) $opponent.country#end"#end>$rst</td>
|
||||
#end
|
||||
#foreach($crit in $criteres)
|
||||
<td>$number.format('0.#', $part[$crit])</td>
|
||||
#set($value = "$number.format('0.#', $part[$crit])")
|
||||
<td data-sort="$value">$value.replace('.5', '½')</td>
|
||||
#end
|
||||
</tr>
|
||||
#end
|
||||
|
Reference in New Issue
Block a user