Show PH values properly
This commit is contained in:
parent
d379b769d3
commit
275e52a546
3 changed files with 31 additions and 2 deletions
|
@ -53,6 +53,7 @@ import info.nightscout.ui.R
|
|||
import info.nightscout.ui.databinding.TreatmentsBolusCarbsFragmentBinding
|
||||
import info.nightscout.ui.databinding.TreatmentsBolusCarbsItemBinding
|
||||
import info.nightscout.ui.dialogs.WizardInfoDialog
|
||||
import info.nightscout.ui.extensions.isPumpHistory
|
||||
import io.reactivex.rxjava3.core.Completable
|
||||
import io.reactivex.rxjava3.disposables.CompositeDisposable
|
||||
import io.reactivex.rxjava3.kotlin.plusAssign
|
||||
|
@ -219,7 +220,7 @@ class TreatmentsBolusCarbsFragment : DaggerFragment(), MenuProvider {
|
|||
holder.binding.bolusTime.text = dateUtil.timeString(bolus.timestamp)
|
||||
holder.binding.insulin.text = rh.gs(info.nightscout.interfaces.R.string.format_insulin_units, bolus.amount)
|
||||
holder.binding.bolusNs.visibility = (bolus.interfaceIDs.nightscoutId != null).toVisibility()
|
||||
holder.binding.bolusPump.visibility = (bolus.interfaceIDs.pumpId != null).toVisibility()
|
||||
holder.binding.bolusPump.visibility = bolus.interfaceIDs.isPumpHistory().toVisibility()
|
||||
holder.binding.bolusInvalid.visibility = bolus.isValid.not().toVisibility()
|
||||
val iob = bolus.iobCalc(activePlugin, System.currentTimeMillis(), profile.dia)
|
||||
if (iob.iobContrib > 0.01) {
|
||||
|
@ -260,7 +261,7 @@ class TreatmentsBolusCarbsFragment : DaggerFragment(), MenuProvider {
|
|||
holder.binding.carbs.text = rh.gs(info.nightscout.core.graph.R.string.format_carbs, carbs.amount.toInt())
|
||||
holder.binding.carbsDuration.text = if (carbs.duration > 0) rh.gs(info.nightscout.core.ui.R.string.format_mins, T.msecs(carbs.duration).mins().toInt()) else ""
|
||||
holder.binding.carbsNs.visibility = (carbs.interfaceIDs.nightscoutId != null).toVisibility()
|
||||
holder.binding.carbsPump.visibility = (carbs.interfaceIDs.pumpId != null).toVisibility()
|
||||
holder.binding.carbsPump.visibility = carbs.interfaceIDs.isPumpHistory().toVisibility()
|
||||
holder.binding.carbsInvalid.visibility = carbs.isValid.not().toVisibility()
|
||||
holder.binding.cbCarbsRemove.visibility = (ml.carbs.isValid && actionHelper.isRemoving).toVisibility()
|
||||
if (actionHelper.isRemoving) {
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
package info.nightscout.ui.extensions
|
||||
|
||||
import info.nightscout.database.entities.embedments.InterfaceIDs
|
||||
|
||||
fun InterfaceIDs.isPumpHistory() = pumpSerial != null && pumpId != null
|
|
@ -0,0 +1,23 @@
|
|||
package info.nightscout.ui.extensions
|
||||
|
||||
import com.google.common.truth.Truth.assertThat
|
||||
import info.nightscout.database.entities.embedments.InterfaceIDs
|
||||
import info.nightscout.sharedtests.TestBase
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
class InterfaceIDsExtensionKtTest : TestBase() {
|
||||
|
||||
@Test
|
||||
fun isPumpHistory() {
|
||||
val sut = InterfaceIDs()
|
||||
assertThat(sut.isPumpHistory()).isFalse()
|
||||
sut.pumpId = 123
|
||||
assertThat(sut.isPumpHistory()).isFalse()
|
||||
sut.pumpId = null
|
||||
sut.pumpSerial = "123"
|
||||
assertThat(sut.isPumpHistory()).isFalse()
|
||||
sut.pumpId = 123
|
||||
sut.pumpSerial = "123"
|
||||
assertThat(sut.isPumpHistory()).isTrue()
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue