Account for negative metric values in telemetry (#532)

pull/533/head
Ben Meadors 2022-12-03 15:53:20 -06:00 zatwierdzone przez GitHub
rodzic 88fabab750
commit dcc03be484
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
1 zmienionych plików z 2 dodań i 2 usunięć

Wyświetl plik

@ -158,7 +158,7 @@ data class NodeInfo(
val batteryStr get() = if (batteryLevel in 1..100) String.format("%d%%", batteryLevel) else ""
private fun envFormat(f: String, unit: String, env: Float?): String =
if (env != null && env > 0f) String.format(f + unit, env) else ""
if (env != null && env != 0f) String.format(f + unit, env) else ""
val envMetricStr
get() = envFormat("%.1f", "°C ", environmentMetrics?.temperature) +
@ -211,4 +211,4 @@ data class NodeInfo(
else -> "%.1f km".format(dist / 1000.0)
}
}
}
}