Remove redundant conversion. Use val where possible.
All checks were successful
Build Android / build (push) Successful in 7m19s

This commit is contained in:
2023-07-18 20:18:35 +02:00
parent 7c940eacb0
commit d81e197d8c

View File

@@ -38,8 +38,8 @@ fun RoundGraphView(rounds: List<Round>, modifier: Modifier = Modifier) {
chart = lineChart(
lines = listOf(specA, specB),
axisValuesOverrider = AxisValuesOverrider.fixed(
minY = range.first.toFloat(),
maxY = range.second.toFloat()
minY = range.first,
maxY = range.second
)
),
model = composedChartEntryModelOf(
@@ -58,8 +58,8 @@ fun RoundGraphView(rounds: List<Round>, modifier: Modifier = Modifier) {
}
private fun getPoints(rounds: List<Round>): Pair<List<FloatEntry>, List<FloatEntry>> {
var a = mutableListOf(FloatEntry(0f, 0f))
var b = mutableListOf(FloatEntry(0f, 0f))
val a = mutableListOf(FloatEntry(0f, 0f))
val b = mutableListOf(FloatEntry(0f, 0f))
var sumA = 0
var sumB = 0
@@ -75,13 +75,13 @@ private fun getPoints(rounds: List<Round>): Pair<List<FloatEntry>, List<FloatEnt
private fun getRange(a: List<FloatEntry>, b: List<FloatEntry>, step: Int): Pair<Float, Float> {
var min = (a + b).minBy { it -> it.y }
var max = (a + b).maxBy { it -> it.y }
val min = (a + b).minBy { it.y }
val max = (a + b).maxBy { it.y }
var lo = floor(min.y / step) * step
var hi = ceil(max.y / step) * step
val lo = floor(min.y / step) * step
val hi = ceil(max.y / step) * step
return Pair(lo.toFloat(), hi.toFloat())
return Pair(lo, hi)
}
@Preview(name = "Light Mode")