remove debugging info

This commit is contained in:
Milos Kozak 2023-08-03 13:28:11 +02:00
parent cb9935d880
commit 1621871ca4
3 changed files with 4 additions and 7 deletions

View file

@ -3,7 +3,6 @@ package info.nightscout.core.iob
import info.nightscout.interfaces.iob.CobInfo import info.nightscout.interfaces.iob.CobInfo
import info.nightscout.interfaces.utils.DecimalFormatter import info.nightscout.interfaces.utils.DecimalFormatter
import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.shared.utils.DateUtil
fun CobInfo.generateCOBString(): String { fun CobInfo.generateCOBString(): String {
var cobStringResult = "--g" var cobStringResult = "--g"
@ -16,11 +15,9 @@ fun CobInfo.generateCOBString(): String {
return cobStringResult return cobStringResult
} }
fun CobInfo.displayText(rh: ResourceHelper, dateUtil: DateUtil, isDev: Boolean): String? = fun CobInfo.displayText(rh: ResourceHelper): String? =
displayCob?.let { displayCob -> displayCob?.let { displayCob ->
var cobText = rh.gs(info.nightscout.core.ui.R.string.format_carbs, displayCob.toInt()) var cobText = rh.gs(info.nightscout.core.ui.R.string.format_carbs, displayCob.toInt())
if (futureCarbs > 0) cobText += "(" + DecimalFormatter.to0Decimal(futureCarbs) + ")" if (futureCarbs > 0) cobText += "(" + DecimalFormatter.to0Decimal(futureCarbs) + ")"
// This is only temporary for debugging
if (isDev) cobText += "\n" + dateUtil.timeString(timestamp)
cobText cobText
} }

View file

@ -914,7 +914,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
private fun updateIobCob() { private fun updateIobCob() {
val iobText = overviewData.iobText(iobCobCalculator) val iobText = overviewData.iobText(iobCobCalculator)
val iobDialogText = overviewData.iobDialogText(iobCobCalculator) val iobDialogText = overviewData.iobDialogText(iobCobCalculator)
val displayText = overviewData.cobInfo(iobCobCalculator).displayText(rh, dateUtil, config.isEngineeringMode()) val displayText = overviewData.cobInfo(iobCobCalculator).displayText(rh)
val lastCarbsTime = overviewData.lastCarbsTime val lastCarbsTime = overviewData.lastCarbsTime
runOnUiThread { runOnUiThread {
_binding ?: return@runOnUiThread _binding ?: return@runOnUiThread
@ -929,7 +929,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
if (constraintsProcessed.carbsReq > 0) { if (constraintsProcessed.carbsReq > 0) {
//only display carbsreq when carbs have not been entered recently //only display carbsreq when carbs have not been entered recently
if (lastCarbsTime < lastRun.lastAPSRun) { if (lastCarbsTime < lastRun.lastAPSRun) {
cobText += " | " + constraintsProcessed.carbsReq + " " + rh.gs(info.nightscout.core.ui.R.string.required) cobText += "\n" + constraintsProcessed.carbsReq + " " + rh.gs(info.nightscout.core.ui.R.string.required)
} }
if (carbAnimation?.isRunning == false) if (carbAnimation?.isRunning == false)
carbAnimation?.start() carbAnimation?.start()

View file

@ -181,7 +181,7 @@ class Widget : AppWidgetProvider() {
private fun updateIobCob(views: RemoteViews) { private fun updateIobCob(views: RemoteViews) {
views.setTextViewText(R.id.iob, overviewData.iobText(iobCobCalculator)) views.setTextViewText(R.id.iob, overviewData.iobText(iobCobCalculator))
// cob // cob
var cobText = overviewData.cobInfo(iobCobCalculator).displayText(rh, dateUtil, isDev = false) ?: rh.gs(info.nightscout.core.ui.R.string.value_unavailable_short) var cobText = overviewData.cobInfo(iobCobCalculator).displayText(rh) ?: rh.gs(info.nightscout.core.ui.R.string.value_unavailable_short)
val constraintsProcessed = loop.lastRun?.constraintsProcessed val constraintsProcessed = loop.lastRun?.constraintsProcessed
val lastRun = loop.lastRun val lastRun = loop.lastRun