Merge pull request #86 from 0pen-dash/avereha/omnipod_common_time_change_event_enabled

Fixed connection quality display
This commit is contained in:
Andrei Vereha 2021-08-10 23:24:24 +02:00 committed by GitHub
commit adb80d801c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View file

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

View file

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