- reverting change done for 1724 (code is still there just commented). I need to rework this, and reuse the code, just on different position)

This commit is contained in:
Andy Rozman 2022-07-24 12:42:33 +01:00
parent 3ea2c761f9
commit 2e40b17973

View file

@ -797,45 +797,46 @@ class MedtronicHistoryData @Inject constructor(
} }
} }
val suspendList = getFilteredItems(newHistory, // // TODO this solution needs to be overworked, commenting out for now
setOf(PumpHistoryEntryType.SuspendPump)) // val suspendList = getFilteredItems(newHistory, //
// setOf(PumpHistoryEntryType.SuspendPump))
val stopList : MutableList<PumpHistoryEntry> = mutableListOf() //
stopList.addAll(suspendList); // val stopList : MutableList<PumpHistoryEntry> = mutableListOf()
stopList.addAll(rewindList); // stopList.addAll(suspendList);
// stopList.addAll(rewindList);
// TODO remove see if rewind items, need to fix any of current tempBasalProcessDTO items (bug 1724) //
if (rewindList.isNotEmpty()) { // // TODO remove see if rewind items, need to fix any of current tempBasalProcessDTO items (bug 1724)
for (rewindEntry in rewindList) { // if (rewindList.isNotEmpty()) {
for (tempBasalProcessDTO in processList) { // for (rewindEntry in rewindList) {
if (tempBasalProcessDTO.itemTwo==null) { // for (tempBasalProcessDTO in processList) {
val endTime: Long = DateTimeUtil.getATDWithAddedMinutes(tempBasalProcessDTO.itemOne.atechDateTime, tempBasalProcessDTO.itemOneTbr!!.durationMinutes) // if (tempBasalProcessDTO.itemTwo==null) {
// val endTime: Long = DateTimeUtil.getATDWithAddedMinutes(tempBasalProcessDTO.itemOne.atechDateTime, tempBasalProcessDTO.itemOneTbr!!.durationMinutes)
if ((rewindEntry.atechDateTime > tempBasalProcessDTO.itemOne.atechDateTime) && //
(rewindEntry.atechDateTime < endTime)) { // if ((rewindEntry.atechDateTime > tempBasalProcessDTO.itemOne.atechDateTime) &&
tempBasalProcessDTO.itemTwo = rewindEntry // (rewindEntry.atechDateTime < endTime)) {
continue // tempBasalProcessDTO.itemTwo = rewindEntry
} // continue
} // }
} // }
} // }
} // }
// }
// see if have rewind/stop items that need to fix any of current tempBasalProcessDTO items (bug 1724) //
if (stopList.isNotEmpty()) { // // see if have rewind/stop items that need to fix any of current tempBasalProcessDTO items (bug 1724)
for (tempBasalProcessDTO in processList) { // if (stopList.isNotEmpty()) {
if (tempBasalProcessDTO.itemTwo==null) { // for (tempBasalProcessDTO in processList) {
val endTime: Long = DateTimeUtil.getATDWithAddedMinutes(tempBasalProcessDTO.itemOne.atechDateTime, tempBasalProcessDTO.itemOneTbr!!.durationMinutes) // if (tempBasalProcessDTO.itemTwo==null) {
// val endTime: Long = DateTimeUtil.getATDWithAddedMinutes(tempBasalProcessDTO.itemOne.atechDateTime, tempBasalProcessDTO.itemOneTbr!!.durationMinutes)
val findNearestEntry = findNearestEntry(tempBasalProcessDTO.itemOne.atechDateTime, endTime, stopList); //
// val findNearestEntry = findNearestEntry(tempBasalProcessDTO.itemOne.atechDateTime, endTime, stopList);
if (findNearestEntry!=null) { //
tempBasalProcessDTO.itemTwo = findNearestEntry // if (findNearestEntry!=null) {
stopList.remove(findNearestEntry) // tempBasalProcessDTO.itemTwo = findNearestEntry
} // stopList.remove(findNearestEntry)
} // }
} // }
} // }
// }
return processList return processList
} }