Fixed connection quality display

This commit is contained in:
Theo van Elsberg 2021-08-10 21:48:25 +02:00
parent 2680402f2e
commit 7dacb18479
2 changed files with 3 additions and 3 deletions

View file

@ -628,9 +628,9 @@ class OmnipodDashPodStateManagerImpl @Inject constructor(
override fun connectionSuccessRatio(): Float {
val attempts = connectionAttempts
if (attempts == 0) {
return 1.0F
return 0.0F
}
return successfulConnections.toFloat() * 100 / attempts.toFloat()
return successfulConnections.toFloat() / attempts.toFloat()
}
override fun reset() {

View file

@ -244,7 +244,7 @@ class OmnipodDashOverviewFragment : DaggerFragment() {
}
val connectionSuccessPercentage = podStateManager.connectionSuccessRatio() * 100
val successPercentageString = String.format("%.2f %%", podStateManager.connectionSuccessRatio())
val successPercentageString = String.format("%.2f %%", connectionSuccessPercentage)
val quality =
"${podStateManager.successfulConnections}/${podStateManager.connectionAttempts} :: $successPercentageString"
bluetoothStatusBinding.omnipodDashBluetoothConnectionQuality.text = quality