@@ -13,7 +13,7 @@ import java.time.LocalDateTime
1313import kotlin.math.abs
1414import kotlin.time.Duration.Companion.minutes
1515
16- private val Double .format8 : String get() = " %,.8f " .format( this )
16+ private const val EPSILON = 1e - 6
1717
1818/* *
1919 * Created by testusuke on 2023/05/05
@@ -339,10 +339,6 @@ object GamesService {
339339 * @param id game id
340340 */
341341 fun calculateLeagueResults (id : Int , restrict : Boolean = false): Result <LeagueResult > {
342- val DEBUG = true
343- val EPSILON = 1e- 6
344- fun d (msg : String ) { if (DEBUG ) println (msg) }
345-
346342 val result = transaction {
347343 val game = GameEntity .findById(id) ? : throw NotFoundException (" invalid game id" )
348344
@@ -454,8 +450,6 @@ object GamesService {
454450 it.loseGoal = - 999.0
455451 it.goalDiff = - 999.0
456452 }
457-
458- d(" TEAM=${it.teamId} avg[score=${it.score.format8} , goal=${it.goal.format8} , diff=${it.goalDiff.format8} ]" )
459453 }
460454
461455 var lastResult: LeagueTeamResult ? = null
@@ -478,20 +472,7 @@ object GamesService {
478472 compareByDescending { it.score }
479473 }
480474 )
481- .mapIndexed { idx, r ->
482- d(" %2d位 TEAM=${r.teamId} score=${r.score.format8} diff=${r.goalDiff.format8} goal=${r.goal.format8} "
483- .format(idx + 1 ))
484- r
485- }
486475 .map { leagueTeamResult ->
487- if (lastResult != null ) {
488- val scoreGap = (leagueTeamResult.score - lastResult!! .score)
489- val diffGap = (leagueTeamResult.goalDiff - lastResult!! .goalDiff)
490- d(" cmp TEAM=${leagueTeamResult.teamId} "
491- + " scoreGap=${scoreGap.format8} diffGap=${diffGap.format8} "
492- + " => rank=${leagueTeamResult.rank} " )
493- }
494-
495476 if (lastResult == null ) {
496477 leagueTeamResult.rank = 1
497478 } else {
0 commit comments