|
|
|
|
@ -55,15 +55,19 @@ class Calculator { |
|
|
|
|
/** |
|
|
|
|
* This function determines whether the standard deviation should be computed |
|
|
|
|
*/ |
|
|
|
|
fun shouldComputeStandardDeviation(): Boolean { |
|
|
|
|
this.displayedStats.forEach { stat -> |
|
|
|
|
return when (stat) { |
|
|
|
|
STANDARD_DEVIATION, STANDARD_DEVIATION_HOURLY, STANDARD_DEVIATION_BB_PER_100_HANDS -> true |
|
|
|
|
else -> false |
|
|
|
|
val computeStandardDeviation: Boolean |
|
|
|
|
get() { |
|
|
|
|
this.displayedStats.forEach { |
|
|
|
|
if (it == STANDARD_DEVIATION_BB_PER_100_HANDS || it == STANDARD_DEVIATION || it == STANDARD_DEVIATION_HOURLY) { |
|
|
|
|
return true |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return false |
|
|
|
|
} |
|
|
|
|
return true |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
val computeLongestStreak = this.displayedStats.contains(LONGEST_STREAKS) |
|
|
|
|
val computeLocationsPlayed = this.displayedStats.contains(LOCATIONS_PLAYED) |
|
|
|
|
val computeDaysPlayed = this.displayedStats.contains(DAYS_PLAYED) |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -163,8 +167,7 @@ class Calculator { |
|
|
|
|
val computables = computableGroup.computables(realm) |
|
|
|
|
Timber.d(">>>> Start computing group ${computableGroup.name}, ${computables.size} computables") |
|
|
|
|
|
|
|
|
|
val computeLongestStreak = options.displayedStats.contains(LONGEST_STREAKS) |
|
|
|
|
if (computeLongestStreak) { |
|
|
|
|
if (options.computeLongestStreak) { |
|
|
|
|
computables.sort("session.startDate") |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -180,12 +183,12 @@ class Calculator { |
|
|
|
|
val maxNetResult = computables.max(ComputableResult.Field.RATED_NET.identifier)?.toDouble() |
|
|
|
|
val minNetResult = computables.min(ComputableResult.Field.RATED_NET.identifier)?.toDouble() |
|
|
|
|
|
|
|
|
|
if (options.displayedStats.contains(LOCATIONS_PLAYED)) { |
|
|
|
|
if (options.computeLocationsPlayed) { |
|
|
|
|
results.addStat(LOCATIONS_PLAYED, computables.distinctBy { it.session?.location?.id }.size.toDouble()) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
val shouldIterateOverComputables = |
|
|
|
|
(options.evolutionValues == Options.EvolutionValues.STANDARD || computeLongestStreak) |
|
|
|
|
(options.evolutionValues == Options.EvolutionValues.STANDARD || options.computeLongestStreak) |
|
|
|
|
|
|
|
|
|
// Iterate for each session |
|
|
|
|
if (shouldIterateOverComputables) { |
|
|
|
|
@ -271,10 +274,9 @@ class Calculator { |
|
|
|
|
val hourlyRate = gSum / gHourlyDuration |
|
|
|
|
// var bbHourlyRate = gBBSum / gDuration |
|
|
|
|
|
|
|
|
|
val computeDaysPlayed = options.displayedStats.contains(DAYS_PLAYED) |
|
|
|
|
val shouldIterateOverSets = (options.evolutionValues != Options.EvolutionValues.NONE || computeDaysPlayed) |
|
|
|
|
val shouldIterateOverSets = (options.evolutionValues != Options.EvolutionValues.NONE || options.computeDaysPlayed) |
|
|
|
|
|
|
|
|
|
if (computeDaysPlayed) { |
|
|
|
|
if (shouldIterateOverSets) { |
|
|
|
|
|
|
|
|
|
var tHourlyDuration = 0.0 |
|
|
|
|
var tIndex = 0 |
|
|
|
|
@ -414,7 +416,7 @@ class Calculator { |
|
|
|
|
val bbPer100Hands = bbSum / totalHands * 100 |
|
|
|
|
|
|
|
|
|
// Standard Deviation |
|
|
|
|
if (options.shouldComputeStandardDeviation()) { |
|
|
|
|
if (options.computeStandardDeviation) { |
|
|
|
|
|
|
|
|
|
// Session |
|
|
|
|
var stdSum = 0.0 |
|
|
|
|
|