add comments

This commit is contained in:
Andrei Vereha 2021-05-31 00:13:52 +02:00
parent a2b3ab5991
commit 7dc01cb1f8

View file

@ -282,6 +282,7 @@ class OmnipodDashPumpPlugin @Inject constructor(
.ignoreElement() .ignoreElement()
) )
).toPumpEnactResult() ).toPumpEnactResult()
// TODO: on error, invalidateTemporaryBasal or sync it only after sending the command
} }
private fun pumpSyncTempBasal( private fun pumpSyncTempBasal(
@ -394,6 +395,8 @@ class OmnipodDashPumpPlugin @Inject constructor(
val historyEntry = history.getById(confirmation.historyId) val historyEntry = history.getById(confirmation.historyId)
when (historyEntry.commandType) { when (historyEntry.commandType) {
OmnipodCommandType.CANCEL_TEMPORARY_BASAL -> OmnipodCommandType.CANCEL_TEMPORARY_BASAL ->
// We can't invalidate this command,
// and this is why it pumpSync-ed at this point
if (confirmation.success) { if (confirmation.success) {
pumpSync.syncStopTemporaryBasalWithPumpId( pumpSync.syncStopTemporaryBasalWithPumpId(
historyEntry.createdAt, historyEntry.createdAt,
@ -403,6 +406,7 @@ class OmnipodDashPumpPlugin @Inject constructor(
) )
} }
OmnipodCommandType.SET_TEMPORARY_BASAL -> OmnipodCommandType.SET_TEMPORARY_BASAL ->
// This treatment was synced before sending the command
if (!confirmation.success) { if (!confirmation.success) {
pumpSync.invalidateTemporaryBasal(historyEntry.pumpId()) pumpSync.invalidateTemporaryBasal(historyEntry.pumpId())
} }