Merge remote-tracking branch 'Nightscout/dev' into Autotune/TuneWeekDaysClean
This commit is contained in:
commit
123f590722
14 changed files with 96 additions and 40 deletions
|
@ -312,7 +312,7 @@ class ActionsFragment : DaggerFragment() {
|
||||||
for (customAction in customActions) {
|
for (customAction in customActions) {
|
||||||
if (!customAction.isEnabled) continue
|
if (!customAction.isEnabled) continue
|
||||||
|
|
||||||
val btn = SingleClickButton(currentContext, null, android.R.attr.buttonStyle)
|
val btn = SingleClickButton(currentContext, null, R.attr.customBtnStyle)
|
||||||
btn.text = rh.gs(customAction.name)
|
btn.text = rh.gs(customAction.name)
|
||||||
|
|
||||||
val layoutParams = LinearLayout.LayoutParams(
|
val layoutParams = LinearLayout.LayoutParams(
|
||||||
|
|
|
@ -582,7 +582,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
|
||||||
for (event in events)
|
for (event in events)
|
||||||
if (event.isEnabled && event.trigger.shouldRun())
|
if (event.isEnabled && event.trigger.shouldRun())
|
||||||
context?.let { context ->
|
context?.let { context ->
|
||||||
SingleClickButton(context).also {
|
SingleClickButton(context, null, R.attr.customBtnStyle).also {
|
||||||
it.setTextColor(rh.gac(context, R.attr.treatmentButton))
|
it.setTextColor(rh.gac(context, R.attr.treatmentButton))
|
||||||
it.setTextSize(TypedValue.COMPLEX_UNIT_SP, 10f)
|
it.setTextSize(TypedValue.COMPLEX_UNIT_SP, 10f)
|
||||||
it.layoutParams = LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.MATCH_PARENT, 0.5f).also { l ->
|
it.layoutParams = LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.MATCH_PARENT, 0.5f).also { l ->
|
||||||
|
|
|
@ -97,11 +97,11 @@ class IobCobOref1Worker(
|
||||||
val bucketedData = ads.bucketedData
|
val bucketedData = ads.bucketedData
|
||||||
val autosensDataTable = ads.autosensDataTable
|
val autosensDataTable = ads.autosensDataTable
|
||||||
if (bucketedData == null || bucketedData.size < 3) {
|
if (bucketedData == null || bucketedData.size < 3) {
|
||||||
aapsLogger.debug(LTag.AUTOSENS, "Aborting calculation thread (No bucketed data available): ${data.from}")
|
aapsLogger.debug(LTag.AUTOSENS, {"Aborting calculation thread (No bucketed data available): ${data.from}"})
|
||||||
return Result.success(workDataOf("Error" to "Aborting calculation thread (No bucketed data available): ${data.from}"))
|
return Result.success(workDataOf("Error" to "Aborting calculation thread (No bucketed data available): ${data.from}"))
|
||||||
}
|
}
|
||||||
val prevDataTime = ads.roundUpTime(bucketedData[bucketedData.size - 3].timestamp)
|
val prevDataTime = ads.roundUpTime(bucketedData[bucketedData.size - 3].timestamp)
|
||||||
aapsLogger.debug(LTag.AUTOSENS, "Prev data time: " + dateUtil.dateAndTimeString(prevDataTime))
|
aapsLogger.debug(LTag.AUTOSENS, {"Prev data time: " + dateUtil.dateAndTimeString(prevDataTime)})
|
||||||
var previous = autosensDataTable[prevDataTime]
|
var previous = autosensDataTable[prevDataTime]
|
||||||
// start from oldest to be able sub cob
|
// start from oldest to be able sub cob
|
||||||
for (i in bucketedData.size - 4 downTo 0) {
|
for (i in bucketedData.size - 4 downTo 0) {
|
||||||
|
@ -156,15 +156,15 @@ class IobCobOref1Worker(
|
||||||
val hourAgoData = ads.getAutosensDataAtTime(hourAgo)
|
val hourAgoData = ads.getAutosensDataAtTime(hourAgo)
|
||||||
if (hourAgoData != null) {
|
if (hourAgoData != null) {
|
||||||
val initialIndex = autosensDataTable.indexOfKey(hourAgoData.time)
|
val initialIndex = autosensDataTable.indexOfKey(hourAgoData.time)
|
||||||
aapsLogger.debug(LTag.AUTOSENS, ">>>>> bucketed_data.size()=" + bucketedData.size + " i=" + i + " hourAgoData=" + hourAgoData.toString())
|
aapsLogger.debug(LTag.AUTOSENS, { ">>>>> bucketed_data.size()=" + bucketedData.size + " i=" + i + " hourAgoData=" + hourAgoData.toString()})
|
||||||
var past = 1
|
var past = 1
|
||||||
try {
|
try {
|
||||||
while (past < 12) {
|
while (past < 12) {
|
||||||
val ad = autosensDataTable.valueAt(initialIndex + past)
|
val ad = autosensDataTable.valueAt(initialIndex + past)
|
||||||
aapsLogger.debug(LTag.AUTOSENS, ">>>>> past=" + past + " ad=" + ad?.toString())
|
aapsLogger.debug(LTag.AUTOSENS, {">>>>> past=" + past + " ad=" + ad?.toString()})
|
||||||
if (ad == null) {
|
if (ad == null) {
|
||||||
aapsLogger.debug(LTag.AUTOSENS, autosensDataTable.toString())
|
aapsLogger.debug(LTag.AUTOSENS, {autosensDataTable.toString()})
|
||||||
aapsLogger.debug(LTag.AUTOSENS, bucketedData.toString())
|
aapsLogger.debug(LTag.AUTOSENS, {bucketedData.toString()})
|
||||||
//aapsLogger.debug(LTag.AUTOSENS, iobCobCalculatorPlugin.getBgReadingsDataTable().toString())
|
//aapsLogger.debug(LTag.AUTOSENS, iobCobCalculatorPlugin.getBgReadingsDataTable().toString())
|
||||||
val notification = Notification(Notification.SEND_LOGFILES, rh.gs(R.string.sendlogfiles), Notification.LOW)
|
val notification = Notification(Notification.SEND_LOGFILES, rh.gs(R.string.sendlogfiles), Notification.LOW)
|
||||||
rxBus.send(EventNewNotification(notification))
|
rxBus.send(EventNewNotification(notification))
|
||||||
|
@ -319,14 +319,12 @@ class IobCobOref1Worker(
|
||||||
if (bgTime < dateUtil.now()) autosensDataTable.put(bgTime, autosensData)
|
if (bgTime < dateUtil.now()) autosensDataTable.put(bgTime, autosensData)
|
||||||
aapsLogger.debug(
|
aapsLogger.debug(
|
||||||
LTag.AUTOSENS,
|
LTag.AUTOSENS,
|
||||||
"Running detectSensitivity from: " + dateUtil.dateAndTimeString(oldestTimeWithData) + " to: " + dateUtil.dateAndTimeString(bgTime) + " lastDataTime:" + ads.lastDataTime(
|
{"Running detectSensitivity from: " + dateUtil.dateAndTimeString(oldestTimeWithData) + " to: " + dateUtil.dateAndTimeString(bgTime) + " lastDataTime:" + ads.lastDataTime(dateUtil)}
|
||||||
dateUtil
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
val sensitivity = activePlugin.activeSensitivity.detectSensitivity(ads, oldestTimeWithData, bgTime)
|
val sensitivity = activePlugin.activeSensitivity.detectSensitivity(ads, oldestTimeWithData, bgTime)
|
||||||
aapsLogger.debug(LTag.AUTOSENS, "Sensitivity result: $sensitivity")
|
aapsLogger.debug(LTag.AUTOSENS, "Sensitivity result: $sensitivity")
|
||||||
autosensData.autosensResult = sensitivity
|
autosensData.autosensResult = sensitivity
|
||||||
aapsLogger.debug(LTag.AUTOSENS, autosensData.toString())
|
aapsLogger.debug(LTag.AUTOSENS, {autosensData.toString()})
|
||||||
}
|
}
|
||||||
data.iobCobCalculator.ads = ads
|
data.iobCobCalculator.ads = ads
|
||||||
Thread {
|
Thread {
|
||||||
|
@ -335,7 +333,7 @@ class IobCobOref1Worker(
|
||||||
}.start()
|
}.start()
|
||||||
} finally {
|
} finally {
|
||||||
rxBus.send(EventIobCalculationProgress(CalculationWorkflow.ProgressData.IOB_COB_OREF, 100, data.cause))
|
rxBus.send(EventIobCalculationProgress(CalculationWorkflow.ProgressData.IOB_COB_OREF, 100, data.cause))
|
||||||
aapsLogger.debug(LTag.AUTOSENS, "AUTOSENSDATA thread ended: ${data.from}")
|
aapsLogger.debug(LTag.AUTOSENS, {"AUTOSENSDATA thread ended: ${data.from}"})
|
||||||
profiler.log(LTag.AUTOSENS, "IobCobOref1Thread", start)
|
profiler.log(LTag.AUTOSENS, "IobCobOref1Thread", start)
|
||||||
}
|
}
|
||||||
return Result.success()
|
return Result.success()
|
||||||
|
|
|
@ -7,9 +7,9 @@ buildscript {
|
||||||
rxjava_version = '3.1.5'
|
rxjava_version = '3.1.5'
|
||||||
rxandroid_version = '3.0.0'
|
rxandroid_version = '3.0.0'
|
||||||
rxkotlin_version = '3.0.1'
|
rxkotlin_version = '3.0.1'
|
||||||
room_version = '2.4.2'
|
room_version = '2.4.3'
|
||||||
lifecycle_version = '2.5.0'
|
lifecycle_version = '2.5.0'
|
||||||
dagger_version = '2.42'
|
dagger_version = '2.43'
|
||||||
coroutines_version = '1.6.4'
|
coroutines_version = '1.6.4'
|
||||||
activity_version = '1.4.0'
|
activity_version = '1.4.0'
|
||||||
fragmentktx_version = '1.4.1'
|
fragmentktx_version = '1.4.1'
|
||||||
|
|
|
@ -57,7 +57,7 @@ class AutosensDataStore {
|
||||||
synchronized(autosensDataTable) {
|
synchronized(autosensDataTable) {
|
||||||
for (index in autosensDataTable.size() - 1 downTo 0) {
|
for (index in autosensDataTable.size() - 1 downTo 0) {
|
||||||
if (autosensDataTable.keyAt(index) > time) {
|
if (autosensDataTable.keyAt(index) > time) {
|
||||||
aapsLogger.debug(LTag.AUTOSENS, "Removing from autosensDataTable: " + dateUtil.dateAndTimeAndSecondsString(autosensDataTable.keyAt(index)))
|
aapsLogger.debug(LTag.AUTOSENS, {"Removing from autosensDataTable: " + dateUtil.dateAndTimeAndSecondsString(autosensDataTable.keyAt(index))})
|
||||||
autosensDataTable.removeAt(index)
|
autosensDataTable.removeAt(index)
|
||||||
} else {
|
} else {
|
||||||
break
|
break
|
||||||
|
@ -135,10 +135,10 @@ class AutosensDataStore {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
return if (data.time < System.currentTimeMillis() - 11 * 60 * 1000) {
|
return if (data.time < System.currentTimeMillis() - 11 * 60 * 1000) {
|
||||||
aapsLogger.debug(LTag.AUTOSENS, "AUTOSENSDATA null: data is old (" + reason + ") size()=" + autosensDataTable.size() + " lastData=" + dateUtil.dateAndTimeAndSecondsString(data.time))
|
aapsLogger.debug(LTag.AUTOSENS, {"AUTOSENSDATA null: data is old (" + reason + ") size()=" + autosensDataTable.size() + " lastData=" + dateUtil.dateAndTimeAndSecondsString(data.time)})
|
||||||
null
|
null
|
||||||
} else {
|
} else {
|
||||||
aapsLogger.debug(LTag.AUTOSENS, "AUTOSENSDATA ($reason) $data")
|
aapsLogger.debug(LTag.AUTOSENS, {"AUTOSENSDATA ($reason) $data"})
|
||||||
data
|
data
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -164,7 +164,7 @@ class AutosensDataStore {
|
||||||
.compatGetBgReadingsDataFromTime(start, to + T.mins(2).msecs(), false)
|
.compatGetBgReadingsDataFromTime(start, to + T.mins(2).msecs(), false)
|
||||||
.blockingGet()
|
.blockingGet()
|
||||||
.filter { it.value >= 39 }
|
.filter { it.value >= 39 }
|
||||||
aapsLogger.debug(LTag.AUTOSENS, "BG data loaded. Size: " + bgReadings.size + " Start date: " + dateUtil.dateAndTimeString(start) + " End date: " + dateUtil.dateAndTimeString(to))
|
aapsLogger.debug(LTag.AUTOSENS, {"BG data loaded. Size: " + bgReadings.size + " Start date: " + dateUtil.dateAndTimeString(start) + " End date: " + dateUtil.dateAndTimeString(to)})
|
||||||
createBucketedData(aapsLogger, dateUtil)
|
createBucketedData(aapsLogger, dateUtil)
|
||||||
rxBus.send(EventBucketedDataCreated())
|
rxBus.send(EventBucketedDataCreated())
|
||||||
}
|
}
|
||||||
|
@ -270,7 +270,7 @@ class AutosensDataStore {
|
||||||
}
|
}
|
||||||
val bData: MutableList<InMemoryGlucoseValue> = ArrayList()
|
val bData: MutableList<InMemoryGlucoseValue> = ArrayList()
|
||||||
bData.add(InMemoryGlucoseValue(bgReadings[0]))
|
bData.add(InMemoryGlucoseValue(bgReadings[0]))
|
||||||
aapsLogger.debug(LTag.AUTOSENS, "Adding. bgTime: " + dateUtil.toISOString(bgReadings[0].timestamp) + " lastBgTime: " + "none-first-value" + " " + bgReadings[0].toString())
|
aapsLogger.debug(LTag.AUTOSENS, {"Adding. bgTime: " + dateUtil.toISOString(bgReadings[0].timestamp) + " lastBgTime: " + "none-first-value" + " " + bgReadings[0].toString()})
|
||||||
var j = 0
|
var j = 0
|
||||||
for (i in 1 until bgReadings.size) {
|
for (i in 1 until bgReadings.size) {
|
||||||
val bgTime = bgReadings[i].timestamp
|
val bgTime = bgReadings[i].timestamp
|
||||||
|
@ -293,7 +293,7 @@ class AutosensDataStore {
|
||||||
val newBgReading = InMemoryGlucoseValue(nextBgTime, nextBg.roundToLong().toDouble(), true)
|
val newBgReading = InMemoryGlucoseValue(nextBgTime, nextBg.roundToLong().toDouble(), true)
|
||||||
//console.error("Interpolated", bData[j]);
|
//console.error("Interpolated", bData[j]);
|
||||||
bData.add(newBgReading)
|
bData.add(newBgReading)
|
||||||
aapsLogger.debug(LTag.AUTOSENS, "Adding. bgTime: " + dateUtil.toISOString(bgTime) + " lastBgTime: " + dateUtil.toISOString(lastBgTime) + " " + newBgReading.toString())
|
aapsLogger.debug(LTag.AUTOSENS, {"Adding. bgTime: " + dateUtil.toISOString(bgTime) + " lastBgTime: " + dateUtil.toISOString(lastBgTime) + " " + newBgReading.toString()})
|
||||||
elapsedMinutes -= 5
|
elapsedMinutes -= 5
|
||||||
lastBg = nextBg
|
lastBg = nextBg
|
||||||
lastBgTime = nextBgTime
|
lastBgTime = nextBgTime
|
||||||
|
@ -301,14 +301,14 @@ class AutosensDataStore {
|
||||||
j++
|
j++
|
||||||
val newBgReading = InMemoryGlucoseValue(bgTime, bgReadings[i].value)
|
val newBgReading = InMemoryGlucoseValue(bgTime, bgReadings[i].value)
|
||||||
bData.add(newBgReading)
|
bData.add(newBgReading)
|
||||||
aapsLogger.debug(LTag.AUTOSENS, "Adding. bgTime: " + dateUtil.toISOString(bgTime) + " lastBgTime: " + dateUtil.toISOString(lastBgTime) + " " + newBgReading.toString())
|
aapsLogger.debug(LTag.AUTOSENS, {"Adding. bgTime: " + dateUtil.toISOString(bgTime) + " lastBgTime: " + dateUtil.toISOString(lastBgTime) + " " + newBgReading.toString()})
|
||||||
}
|
}
|
||||||
|
|
||||||
abs(elapsedMinutes) > 2 -> {
|
abs(elapsedMinutes) > 2 -> {
|
||||||
j++
|
j++
|
||||||
val newBgReading = InMemoryGlucoseValue(bgTime, bgReadings[i].value)
|
val newBgReading = InMemoryGlucoseValue(bgTime, bgReadings[i].value)
|
||||||
bData.add(newBgReading)
|
bData.add(newBgReading)
|
||||||
aapsLogger.debug(LTag.AUTOSENS, "Adding. bgTime: " + dateUtil.toISOString(bgTime) + " lastBgTime: " + dateUtil.toISOString(lastBgTime) + " " + newBgReading.toString())
|
aapsLogger.debug(LTag.AUTOSENS, {"Adding. bgTime: " + dateUtil.toISOString(bgTime) + " lastBgTime: " + dateUtil.toISOString(lastBgTime) + " " + newBgReading.toString()})
|
||||||
}
|
}
|
||||||
|
|
||||||
else -> {
|
else -> {
|
||||||
|
@ -327,7 +327,7 @@ class AutosensDataStore {
|
||||||
val previous = bData[i + 1]
|
val previous = bData[i + 1]
|
||||||
val mSecDiff = current.timestamp - previous.timestamp
|
val mSecDiff = current.timestamp - previous.timestamp
|
||||||
val adjusted = (mSecDiff - T.mins(5).msecs()) / 1000
|
val adjusted = (mSecDiff - T.mins(5).msecs()) / 1000
|
||||||
aapsLogger.debug(LTag.AUTOSENS, "Adjusting bucketed data time. Current: " + dateUtil.dateAndTimeAndSecondsString(current.timestamp) + " to: " + dateUtil.dateAndTimeAndSecondsString(previous.timestamp + T.mins(5).msecs()) + " by " + adjusted + " sec")
|
aapsLogger.debug(LTag.AUTOSENS, {"Adjusting bucketed data time. Current: " + dateUtil.dateAndTimeAndSecondsString(current.timestamp) + " to: " + dateUtil.dateAndTimeAndSecondsString(previous.timestamp + T.mins(5).msecs()) + " by " + adjusted + " sec"})
|
||||||
if (abs(adjusted) > 90) {
|
if (abs(adjusted) > 90) {
|
||||||
// too big adjustment, fallback to non 5 min data
|
// too big adjustment, fallback to non 5 min data
|
||||||
aapsLogger.debug(LTag.AUTOSENS, "Fallback to non 5 min data")
|
aapsLogger.debug(LTag.AUTOSENS, "Fallback to non 5 min data")
|
||||||
|
|
|
@ -248,6 +248,8 @@
|
||||||
<item name="crossTargetColor">@color/white</item>
|
<item name="crossTargetColor">@color/white</item>
|
||||||
<!---Spinner style from pump common-->
|
<!---Spinner style from pump common-->
|
||||||
<item name="android:spinnerItemStyle">@style/CommonSpinnerItemStyle</item>
|
<item name="android:spinnerItemStyle">@style/CommonSpinnerItemStyle</item>
|
||||||
|
<!---Custom button -->
|
||||||
|
<item name="customBtnStyle">@style/GrayButton</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -218,4 +218,6 @@
|
||||||
<!---Icons in Loop area -->
|
<!---Icons in Loop area -->
|
||||||
<attr name="profileColor" format="reference|color" />
|
<attr name="profileColor" format="reference|color" />
|
||||||
<attr name="crossTargetColor" format="reference|color" />
|
<attr name="crossTargetColor" format="reference|color" />
|
||||||
|
<!---Custom button -->
|
||||||
|
<attr name="customBtnStyle" format="reference"/>
|
||||||
</resources>
|
</resources>
|
|
@ -249,6 +249,8 @@
|
||||||
<item name="crossTargetColor">@color/white</item>
|
<item name="crossTargetColor">@color/white</item>
|
||||||
<!---Spinner style from pump common-->
|
<!---Spinner style from pump common-->
|
||||||
<item name="android:spinnerItemStyle">@style/CommonSpinnerItemStyle</item>
|
<item name="android:spinnerItemStyle">@style/CommonSpinnerItemStyle</item>
|
||||||
|
<!---Custom button -->
|
||||||
|
<item name="customBtnStyle">@style/GrayButton</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="CommonSpinnerItemStyle" parent="Widget.AppCompat.TextView.SpinnerItem">
|
<style name="CommonSpinnerItemStyle" parent="Widget.AppCompat.TextView.SpinnerItem">
|
||||||
|
|
|
@ -7,6 +7,5 @@
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:paddingStart="16dp"
|
android:paddingStart="16dp"
|
||||||
android:paddingEnd="0dp"
|
android:paddingEnd="0dp"
|
||||||
android:textColor="#FFFFFF"
|
|
||||||
android:textSize="20sp"
|
android:textSize="20sp"
|
||||||
tools:text="Test" />
|
tools:text="Test" />
|
||||||
|
|
|
@ -34,7 +34,6 @@
|
||||||
android:gravity="start"
|
android:gravity="start"
|
||||||
android:paddingStart="5dp"
|
android:paddingStart="5dp"
|
||||||
android:paddingEnd="0dp"
|
android:paddingEnd="0dp"
|
||||||
android:textColor="@android:color/white"
|
|
||||||
android:textSize="14sp" />
|
android:textSize="14sp" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
|
@ -797,24 +797,68 @@ class MedtronicHistoryData @Inject constructor(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// see if rewind items, need to fix any of current tempBasalProcessDTO items (bug 1724)
|
// TODO this solution needs to be overworked, commenting out for now
|
||||||
if (rewindList.isNotEmpty()) {
|
// val suspendList = getFilteredItems(newHistory, //
|
||||||
for (rewindEntry in rewindList) {
|
// setOf(PumpHistoryEntryType.SuspendPump))
|
||||||
for (tempBasalProcessDTO in processList) {
|
//
|
||||||
if (tempBasalProcessDTO.itemTwo==null) {
|
// val stopList : MutableList<PumpHistoryEntry> = mutableListOf()
|
||||||
val endTime: Long = DateTimeUtil.getATDWithAddedMinutes(tempBasalProcessDTO.itemOne.atechDateTime, tempBasalProcessDTO.itemOneTbr!!.durationMinutes)
|
// 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)
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
if ((rewindEntry.atechDateTime > tempBasalProcessDTO.itemOne.atechDateTime) &&
|
return processList
|
||||||
(rewindEntry.atechDateTime < endTime)) {
|
}
|
||||||
tempBasalProcessDTO.itemTwo = rewindEntry
|
|
||||||
continue
|
fun findNearestEntry(startTime: Long, endTime: Long, list: MutableList<PumpHistoryEntry>) : PumpHistoryEntry? {
|
||||||
}
|
val outList: MutableList<PumpHistoryEntry> = mutableListOf()
|
||||||
}
|
|
||||||
}
|
for (pumpHistoryEntry in list) {
|
||||||
|
if ((pumpHistoryEntry.atechDateTime > startTime) &&
|
||||||
|
(pumpHistoryEntry.atechDateTime < endTime)) {
|
||||||
|
outList.add(pumpHistoryEntry)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return processList
|
if (outList.size == 0) {
|
||||||
|
return null
|
||||||
|
} else if (outList.size==1) {
|
||||||
|
return outList[0]
|
||||||
|
} else {
|
||||||
|
// TODO
|
||||||
|
return null
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun isTBRActive(dbEntry: PumpDbEntryTBR): Boolean {
|
fun isTBRActive(dbEntry: PumpDbEntryTBR): Boolean {
|
||||||
|
|
|
@ -9,6 +9,7 @@ interface AAPSLogger {
|
||||||
fun debug(message: String)
|
fun debug(message: String)
|
||||||
fun debug(enable: Boolean, tag: LTag, message: String)
|
fun debug(enable: Boolean, tag: LTag, message: String)
|
||||||
fun debug(tag: LTag, message: String)
|
fun debug(tag: LTag, message: String)
|
||||||
|
fun debug(tag: LTag, accessor: () -> String)
|
||||||
fun debug(tag: LTag, format: String, vararg arguments: Any?)
|
fun debug(tag: LTag, format: String, vararg arguments: Any?)
|
||||||
fun warn(tag: LTag, message: String)
|
fun warn(tag: LTag, message: String)
|
||||||
fun warn(tag: LTag, format: String, vararg arguments: Any?)
|
fun warn(tag: LTag, format: String, vararg arguments: Any?)
|
||||||
|
|
|
@ -22,6 +22,11 @@ class AAPSLoggerProduction constructor(val l: L) : AAPSLogger {
|
||||||
LoggerFactory.getLogger(tag.tag).debug(stackLogMarker() + message)
|
LoggerFactory.getLogger(tag.tag).debug(stackLogMarker() + message)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun debug(tag: LTag, accessor: () -> String) {
|
||||||
|
if (l.findByName(tag.tag).enabled)
|
||||||
|
LoggerFactory.getLogger(tag.tag).debug(stackLogMarker() + accessor.invoke())
|
||||||
|
}
|
||||||
|
|
||||||
override fun debug(tag: LTag, format: String, vararg arguments: Any?) {
|
override fun debug(tag: LTag, format: String, vararg arguments: Any?) {
|
||||||
if (l.findByName(tag.tag).enabled)
|
if (l.findByName(tag.tag).enabled)
|
||||||
LoggerFactory.getLogger(tag.tag).debug(stackLogMarker() + format, arguments)
|
LoggerFactory.getLogger(tag.tag).debug(stackLogMarker() + format, arguments)
|
||||||
|
|
|
@ -18,6 +18,10 @@ class AAPSLoggerTest : AAPSLogger {
|
||||||
println("DEBUG: : " + tag.tag + " " + message)
|
println("DEBUG: : " + tag.tag + " " + message)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun debug(tag: LTag, accessor: () -> String) {
|
||||||
|
println("DEBUG: : " + tag.tag + " " + accessor.invoke())
|
||||||
|
}
|
||||||
|
|
||||||
override fun debug(tag: LTag, format: String, vararg arguments: Any?) {
|
override fun debug(tag: LTag, format: String, vararg arguments: Any?) {
|
||||||
println("DEBUG: : " + tag.tag + " " + String.format(format, arguments))
|
println("DEBUG: : " + tag.tag + " " + String.format(format, arguments))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue