Fix unit test, cleanup
This commit is contained in:
parent
41f51d26c0
commit
966939a9de
35 changed files with 36 additions and 37 deletions
|
@ -10,4 +10,4 @@ interface Medtrum {
|
|||
fun clearAlarms(): PumpEnactResult // clear alarms
|
||||
fun deactivate(): PumpEnactResult // deactivate patch
|
||||
fun updateTime(): PumpEnactResult // update time
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -14,4 +14,4 @@
|
|||
android:exported="false" />
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
</manifest>
|
||||
|
|
|
@ -23,4 +23,4 @@ class OnSafeClickListener(
|
|||
// Set duplicate click prevention time
|
||||
private const val MIN_CLICK_INTERVAL: Long = 1000
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,4 +5,4 @@ enum class ConnectionState {
|
|||
DISCONNECTED,
|
||||
CONNECTING,
|
||||
DISCONNECTING;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,4 +20,4 @@ enum class AlarmState {
|
|||
BASE_FAULT, // Mapped from pump status 101
|
||||
BATTERY_OUT, // Mapped from pump status 102
|
||||
NO_CALIBRATION // Mapped from pump status 103
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
@ -306,4 +306,4 @@ class GetRecordPacket(injector: HasAndroidInjector, private val recordIndex: Int
|
|||
|
||||
return success
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,4 +16,4 @@ private inline fun FragmentManager.transact(action: FragmentTransaction.() -> Un
|
|||
beginTransaction().apply {
|
||||
action()
|
||||
}.commit()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -54,4 +54,4 @@ abstract class MedtrumBaseActivity<B : ViewDataBinding> : DaggerAppCompatActivit
|
|||
finish()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,4 +63,4 @@ abstract class MedtrumBaseFragment<B : ViewDataBinding> : DaggerFragment(), Medt
|
|||
override fun finish(finishAffinity: Boolean) {
|
||||
baseActivity?.finish(finishAffinity)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,4 +4,4 @@ interface MedtrumBaseNavigator {
|
|||
fun back()
|
||||
|
||||
fun finish(finishAffinity: Boolean = false)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,4 +61,4 @@ class MedtrumOverviewFragment : MedtrumBaseFragment<FragmentMedtrumOverviewBindi
|
|||
override fun onResume() {
|
||||
super.onResume()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,4 +26,4 @@ open class SingleLiveEvent<T> : MutableLiveData<T>() {
|
|||
fun call() {
|
||||
value = null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 -> {
|
||||
|
|
|
@ -37,4 +37,4 @@ class ViewModelFactory @Inject constructor(private val creators: Map<Class<out V
|
|||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,4 +47,4 @@
|
|||
|
||||
</LinearLayout>
|
||||
|
||||
</layout>
|
||||
</layout>
|
||||
|
|
|
@ -77,4 +77,4 @@
|
|||
|
||||
</ScrollView>
|
||||
|
||||
</layout>
|
||||
</layout>
|
||||
|
|
|
@ -76,4 +76,4 @@
|
|||
|
||||
</ScrollView>
|
||||
|
||||
</layout>
|
||||
</layout>
|
||||
|
|
|
@ -91,4 +91,4 @@
|
|||
|
||||
</ScrollView>
|
||||
|
||||
</layout>
|
||||
</layout>
|
||||
|
|
|
@ -78,4 +78,4 @@
|
|||
|
||||
</ScrollView>
|
||||
|
||||
</layout>
|
||||
</layout>
|
||||
|
|
|
@ -89,4 +89,4 @@
|
|||
|
||||
</ScrollView>
|
||||
|
||||
</layout>
|
||||
</layout>
|
||||
|
|
|
@ -106,4 +106,4 @@
|
|||
|
||||
</ScrollView>
|
||||
|
||||
</layout>
|
||||
</layout>
|
||||
|
|
|
@ -106,4 +106,4 @@
|
|||
|
||||
</ScrollView>
|
||||
|
||||
</layout>
|
||||
</layout>
|
||||
|
|
|
@ -93,4 +93,4 @@
|
|||
|
||||
</ScrollView>
|
||||
|
||||
</layout>
|
||||
</layout>
|
||||
|
|
|
@ -93,4 +93,4 @@
|
|||
|
||||
</ScrollView>
|
||||
|
||||
</layout>
|
||||
</layout>
|
||||
|
|
|
@ -104,4 +104,4 @@
|
|||
|
||||
</ScrollView>
|
||||
|
||||
</layout>
|
||||
</layout>
|
||||
|
|
|
@ -90,4 +90,4 @@
|
|||
|
||||
</ScrollView>
|
||||
|
||||
</layout>
|
||||
</layout>
|
||||
|
|
|
@ -63,4 +63,4 @@
|
|||
|
||||
</ScrollView>
|
||||
|
||||
</layout>
|
||||
</layout>
|
||||
|
|
|
@ -88,4 +88,4 @@
|
|||
|
||||
</ScrollView>
|
||||
|
||||
</layout>
|
||||
</layout>
|
||||
|
|
|
@ -104,4 +104,4 @@ class ProfileStoreObject(val injector: HasAndroidInjector, override val data: JS
|
|||
.map { profileName -> getSpecificProfile(profileName.toString()) }
|
||||
.map { pureProfile -> pureProfile?.let { ProfileSealed.Pure(pureProfile).isValid("allProfilesValid", activePlugin.activePump, config, rh, rxBus, hardLimits, false) } }
|
||||
.all { it?.isValid == true }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,4 +59,4 @@ class GetRecordPacketTest : MedtrumTestBase() {
|
|||
assertEquals(false, result)
|
||||
assertEquals(true, packet.failed)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -88,4 +88,4 @@ class NotificationPacketTest : MedtrumTestBase() {
|
|||
assertEquals(1.65, medtrumPump.bolusingTreatment!!.insulin, 0.01)
|
||||
assertEquals(161.95, medtrumPump.reservoir, 0.01)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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