From 2e40b17973f8202cb307ada3d355ee6bf1f28515 Mon Sep 17 00:00:00 2001 From: Andy Rozman Date: Sun, 24 Jul 2022 12:42:33 +0100 Subject: [PATCH] - reverting change done for 1724 (code is still there just commented). I need to rework this, and reuse the code, just on different position) --- .../medtronic/data/MedtronicHistoryData.kt | 79 ++++++++++--------- 1 file changed, 40 insertions(+), 39 deletions(-) diff --git a/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/MedtronicHistoryData.kt b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/MedtronicHistoryData.kt index d54a3ca2e5..6f17edbe0c 100644 --- a/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/MedtronicHistoryData.kt +++ b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/MedtronicHistoryData.kt @@ -797,45 +797,46 @@ class MedtronicHistoryData @Inject constructor( } } - val suspendList = getFilteredItems(newHistory, // - setOf(PumpHistoryEntryType.SuspendPump)) - - val stopList : MutableList = mutableListOf() - 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()) { - for (rewindEntry in rewindList) { - for (tempBasalProcessDTO in processList) { - if (tempBasalProcessDTO.itemTwo==null) { - val endTime: Long = DateTimeUtil.getATDWithAddedMinutes(tempBasalProcessDTO.itemOne.atechDateTime, tempBasalProcessDTO.itemOneTbr!!.durationMinutes) - - if ((rewindEntry.atechDateTime > tempBasalProcessDTO.itemOne.atechDateTime) && - (rewindEntry.atechDateTime < endTime)) { - tempBasalProcessDTO.itemTwo = rewindEntry - continue - } - } - } - } - } - - // see if have rewind/stop items that need to fix any of current tempBasalProcessDTO items (bug 1724) - if (stopList.isNotEmpty()) { - for (tempBasalProcessDTO in processList) { - if (tempBasalProcessDTO.itemTwo==null) { - val endTime: Long = DateTimeUtil.getATDWithAddedMinutes(tempBasalProcessDTO.itemOne.atechDateTime, tempBasalProcessDTO.itemOneTbr!!.durationMinutes) - - val findNearestEntry = findNearestEntry(tempBasalProcessDTO.itemOne.atechDateTime, endTime, stopList); - - if (findNearestEntry!=null) { - tempBasalProcessDTO.itemTwo = findNearestEntry - stopList.remove(findNearestEntry) - } - } - } - } + // TODO this solution needs to be overworked, commenting out for now + // val suspendList = getFilteredItems(newHistory, // + // setOf(PumpHistoryEntryType.SuspendPump)) + // + // val stopList : MutableList = mutableListOf() + // 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()) { + // for (rewindEntry in rewindList) { + // for (tempBasalProcessDTO in processList) { + // if (tempBasalProcessDTO.itemTwo==null) { + // val endTime: Long = DateTimeUtil.getATDWithAddedMinutes(tempBasalProcessDTO.itemOne.atechDateTime, tempBasalProcessDTO.itemOneTbr!!.durationMinutes) + // + // if ((rewindEntry.atechDateTime > tempBasalProcessDTO.itemOne.atechDateTime) && + // (rewindEntry.atechDateTime < endTime)) { + // tempBasalProcessDTO.itemTwo = rewindEntry + // continue + // } + // } + // } + // } + // } + // + // // see if have rewind/stop items that need to fix any of current tempBasalProcessDTO items (bug 1724) + // if (stopList.isNotEmpty()) { + // for (tempBasalProcessDTO in processList) { + // if (tempBasalProcessDTO.itemTwo==null) { + // val endTime: Long = DateTimeUtil.getATDWithAddedMinutes(tempBasalProcessDTO.itemOne.atechDateTime, tempBasalProcessDTO.itemOneTbr!!.durationMinutes) + // + // val findNearestEntry = findNearestEntry(tempBasalProcessDTO.itemOne.atechDateTime, endTime, stopList); + // + // if (findNearestEntry!=null) { + // tempBasalProcessDTO.itemTwo = findNearestEntry + // stopList.remove(findNearestEntry) + // } + // } + // } + // } return processList }