- log changes, little bit of refactoring on PumpSyncStorage class
This commit is contained in:
parent
86625601d6
commit
f2ed33c237
2 changed files with 10 additions and 3 deletions
|
@ -9,6 +9,7 @@ import info.nightscout.androidaps.interfaces.PumpSync
|
|||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.pump.common.defs.PumpType
|
||||
import info.nightscout.androidaps.plugins.pump.common.sync.PumpDbEntry
|
||||
import info.nightscout.androidaps.plugins.pump.common.utils.DateTimeUtil
|
||||
import info.nightscout.androidaps.plugins.pump.common.utils.StringUtil
|
||||
import info.nightscout.androidaps.plugins.pump.medtronic.comm.history.pump.MedtronicPumpHistoryDecoder
|
||||
|
@ -490,9 +491,11 @@ class MedtronicHistoryData @Inject constructor(
|
|||
if (!multiwave) {
|
||||
val entryWithTempId = findDbEntry(bolus, boluses)
|
||||
|
||||
aapsLogger.debug(LTag.PUMP, String.format("DD: entryWithTempId=%s", gson.toJson(entryWithTempId)))
|
||||
aapsLogger.debug(LTag.PUMP, String.format("DD: entryWithTempId=%s", entryWithTempId))
|
||||
|
||||
if (entryWithTempId != null) {
|
||||
aapsLogger.debug(LTag.PUMP, String.format("DD: entryWithTempId.bolusData=%s", if (entryWithTempId.bolusData == null) "null" else entryWithTempId.bolusData))
|
||||
|
||||
temporaryId = entryWithTempId.temporaryId
|
||||
pumpSyncStorage.removeBolusWithTemporaryId(temporaryId)
|
||||
boluses.remove(entryWithTempId)
|
||||
|
@ -725,7 +728,7 @@ class MedtronicHistoryData @Inject constructor(
|
|||
/**
|
||||
* Looks at all boluses that have temporaryId and find one that is correct for us (if such entry exists)
|
||||
*/
|
||||
private fun findDbEntry(treatment: PumpHistoryEntry, temporaryEntries: MutableList<info.nightscout.androidaps.plugins.pump.common.sync.PumpDbEntry>): info.nightscout.androidaps.plugins.pump.common.sync.PumpDbEntry? {
|
||||
private fun findDbEntry(treatment: PumpHistoryEntry, temporaryEntries: MutableList<PumpDbEntry>): PumpDbEntry? {
|
||||
|
||||
if (temporaryEntries.isEmpty()) {
|
||||
return null
|
||||
|
|
|
@ -97,7 +97,11 @@ class PumpSyncStorage @Inject constructor(
|
|||
if (result && writeToInternalHistory) {
|
||||
val innerList: MutableList<PumpDbEntry> = pumpSyncStorage[BOLUS]!!
|
||||
|
||||
innerList.add(PumpDbEntry(temporaryId, detailedBolusInfo.timestamp, creator.model(), creator.serialNumber(), detailedBolusInfo))
|
||||
val dbEntry = PumpDbEntry(temporaryId, detailedBolusInfo.timestamp, creator.model(), creator.serialNumber(), detailedBolusInfo)
|
||||
|
||||
aapsLogger.debug("PumpDbEntry: $dbEntry")
|
||||
|
||||
innerList.add(dbEntry)
|
||||
pumpSyncStorage[BOLUS] = innerList
|
||||
saveStorage()
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue