Merge pull request #547 from andyrozman/mdt_new_fix_1
- fix of the problem encountered by Ghosa Sardes
This commit is contained in:
commit
23bf22a5b9
|
@ -600,7 +600,9 @@ class MedtronicHistoryData @Inject constructor(
|
|||
}
|
||||
processDTO = TempBasalProcessDTO(
|
||||
itemOne = treatment,
|
||||
processOperation = TempBasalProcessDTO.Operation.Add)
|
||||
processOperation = TempBasalProcessDTO.Operation.Add,
|
||||
aapsLogger = aapsLogger
|
||||
)
|
||||
}
|
||||
}
|
||||
if (processDTO != null) {
|
||||
|
@ -841,7 +843,8 @@ class MedtronicHistoryData @Inject constructor(
|
|||
outList.add(TempBasalProcessDTO(
|
||||
itemOne = filtered2Items[i],
|
||||
itemTwo = filtered2Items[i + 1],
|
||||
processOperation = TempBasalProcessDTO.Operation.Add))
|
||||
processOperation = TempBasalProcessDTO.Operation.Add,
|
||||
aapsLogger = aapsLogger))
|
||||
|
||||
i += 2
|
||||
}
|
||||
|
@ -906,14 +909,16 @@ class MedtronicHistoryData @Inject constructor(
|
|||
outList.add(TempBasalProcessDTO(
|
||||
itemOne = items[items.size - 1],
|
||||
itemTwo = itemTwo,
|
||||
processOperation = TempBasalProcessDTO.Operation.Add))
|
||||
processOperation = TempBasalProcessDTO.Operation.Add,
|
||||
aapsLogger = aapsLogger))
|
||||
return outList
|
||||
}
|
||||
items = getFilteredItems(tempData, PumpHistoryEntryType.Rewind)
|
||||
if (items.size > 0) {
|
||||
outList.add(TempBasalProcessDTO(
|
||||
itemOne = items[0],
|
||||
processOperation = TempBasalProcessDTO.Operation.Add))
|
||||
processOperation = TempBasalProcessDTO.Operation.Add,
|
||||
aapsLogger = aapsLogger))
|
||||
return outList
|
||||
}
|
||||
return outList
|
||||
|
|
|
@ -1,11 +1,14 @@
|
|||
package info.nightscout.androidaps.plugins.pump.medtronic.data.dto
|
||||
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.plugins.pump.common.utils.DateTimeUtil
|
||||
import info.nightscout.androidaps.plugins.pump.medtronic.comm.history.pump.PumpHistoryEntry
|
||||
|
||||
class TempBasalProcessDTO constructor(var itemOne: PumpHistoryEntry,
|
||||
var itemTwo: PumpHistoryEntry? = null,
|
||||
var processOperation: Operation = Operation.None) {
|
||||
var processOperation: Operation = Operation.None,
|
||||
var aapsLogger: AAPSLogger) {
|
||||
|
||||
var cancelPresent: Boolean = false
|
||||
|
||||
val atechDateTime: Long
|
||||
|
@ -16,8 +19,13 @@ class TempBasalProcessDTO constructor(var itemOne: PumpHistoryEntry,
|
|||
|
||||
val duration: Int
|
||||
get() = if (itemTwo == null) {
|
||||
val tbr = itemOne.getDecodedDataEntry("Object") as TempBasalPair
|
||||
tbr.durationMinutes
|
||||
val tbr = itemOne.getDecodedDataEntry("Object") as? TempBasalPair
|
||||
if (tbr != null)
|
||||
tbr.durationMinutes
|
||||
else {
|
||||
aapsLogger.error("Couldn't find TempBasalPair in entry: $itemOne")
|
||||
0
|
||||
}
|
||||
} else {
|
||||
DateTimeUtil.getATechDateDiferenceAsMinutes(itemOne.atechDateTime, itemTwo!!.atechDateTime)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue