Fix unit test, cleanup
This commit is contained in:
parent
41f51d26c0
commit
966939a9de
35 changed files with 36 additions and 37 deletions
|
@ -393,7 +393,7 @@
|
|||
<string name="carbs_g">CARBS %1$d g</string>
|
||||
<string name="extended_bolus_u_min">EXTENDED BOLUS %1$.2f U %2$d min</string>
|
||||
<string name="load_events">LOAD EVENTS</string>
|
||||
<string name="clear_alarms">CLEAR_ALARMS</string>
|
||||
<string name="clear_alarms">CLEAR ALARMS</string>
|
||||
<string name="deactivate">DEACTIVATE</string>
|
||||
<string name="update_time">UPDATE TIME</string>
|
||||
<string name="load_history">LOAD HISTORY %1$d</string>
|
||||
|
|
|
@ -223,7 +223,7 @@ class GetRecordPacket(injector: HasAndroidInjector, private val recordIndex: Int
|
|||
var duration = (basalEndTime - basalStartTime)
|
||||
// Work around for pumpSync not accepting 0 duration.
|
||||
// sometimes we get 0 duration for very short basal because the pump only reports time in seconds
|
||||
if (duration < 250) duration = 250 // 250ms to make sure timestamp is unique
|
||||
if (duration < 250) duration = 250 // 250ms to make sure AAPS accepts it
|
||||
|
||||
val newRecord = pumpSync.syncTemporaryBasalWithPumpId(
|
||||
timestamp = basalStartTime,
|
||||
|
|
|
@ -240,7 +240,7 @@ class MedtrumService : DaggerService(), BLECommCallback {
|
|||
|
||||
fun loadEvents(): Boolean {
|
||||
rxBus.send(EventPumpStatusChanged(rh.gs(R.string.gettingpumpstatus)))
|
||||
// Sync records (based on the info we have from the sync)
|
||||
// Sync records
|
||||
val result = syncRecords()
|
||||
if (result) {
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "Events loaded")
|
||||
|
|
|
@ -187,4 +187,3 @@ class MedtrumOverviewViewModel @Inject constructor(
|
|||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -140,6 +140,7 @@ class MedtrumViewModel @Inject constructor(
|
|||
when (newPatchStep) {
|
||||
PatchStep.CANCEL -> {
|
||||
if (oldPatchStep !in listOf(
|
||||
PatchStep.PREPARE_PATCH,
|
||||
PatchStep.START_DEACTIVATION,
|
||||
PatchStep.DEACTIVATE,
|
||||
PatchStep.FORCE_DEACTIVATION,
|
||||
|
@ -148,7 +149,6 @@ class MedtrumViewModel @Inject constructor(
|
|||
) {
|
||||
medtrumService?.disconnect("Cancel")
|
||||
}
|
||||
medtrumService?.disconnect("Cancel")
|
||||
}
|
||||
|
||||
PatchStep.COMPLETE -> {
|
||||
|
|
|
@ -93,10 +93,10 @@ class SynchronizePacketTest : MedtrumTestBase() {
|
|||
assertEquals(25, packet.medtrumPump.lastBasalSequence)
|
||||
assertEquals(14, packet.medtrumPump.lastBasalPatchId)
|
||||
assertEquals(1685126612000, packet.medtrumPump.lastBasalStartTime)
|
||||
assertEquals(8123, packet.medtrumPump.patchAge)
|
||||
assertEquals(186.80, packet.medtrumPump.reservoir, 0.01)
|
||||
assertEquals(296585720, packet.medtrumPump.patchAge)
|
||||
assertEquals(1685120120000, packet.medtrumPump.patchStartTime)
|
||||
assertEquals(5.96875, packet.medtrumPump.batteryVoltage_A, 0.01)
|
||||
assertEquals(2.8125, packet.medtrumPump.batteryVoltage_B, 0.01)
|
||||
assertEquals(1388542523000, packet.medtrumPump.patchStartTime)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue