Merge pull request #461 from Philoul/meallink_VWU_v2
Update for uel.log
This commit is contained in:
commit
d9f62b24c4
|
@ -85,14 +85,14 @@ class NSClientAddUpdateWorker(
|
|||
.blockingGet()
|
||||
.also { result ->
|
||||
result.inserted.forEach {
|
||||
uel.log(Action.CAREPORTAL, Sources.NSClient,
|
||||
uel.log(Action.BOLUS, Sources.NSClient,
|
||||
ValueWithUnit.Timestamp(it.timestamp),
|
||||
ValueWithUnit.Insulin(it.amount)
|
||||
)
|
||||
aapsLogger.debug(LTag.DATABASE, "Inserted bolus $it")
|
||||
}
|
||||
result.invalidated.forEach {
|
||||
uel.log(Action.CAREPORTAL_REMOVED, Sources.NSClient,
|
||||
uel.log(Action.BOLUS_REMOVED, Sources.NSClient,
|
||||
ValueWithUnit.Timestamp(it.timestamp),
|
||||
ValueWithUnit.Insulin(it.amount)
|
||||
)
|
||||
|
@ -114,14 +114,14 @@ class NSClientAddUpdateWorker(
|
|||
.blockingGet()
|
||||
.also { result ->
|
||||
result.inserted.forEach {
|
||||
uel.log(Action.CAREPORTAL, Sources.NSClient,
|
||||
uel.log(Action.CARBS, Sources.NSClient,
|
||||
ValueWithUnit.Timestamp(it.timestamp),
|
||||
ValueWithUnit.Gram(it.amount.toInt())
|
||||
)
|
||||
aapsLogger.debug(LTag.DATABASE, "Inserted carbs $it")
|
||||
}
|
||||
result.invalidated.forEach {
|
||||
uel.log(Action.CAREPORTAL, Sources.NSClient,
|
||||
uel.log(Action.CARBS_REMOVED, Sources.NSClient,
|
||||
ValueWithUnit.Timestamp(it.timestamp),
|
||||
ValueWithUnit.Gram(it.amount.toInt())
|
||||
)
|
||||
|
@ -194,8 +194,13 @@ class NSClientAddUpdateWorker(
|
|||
}
|
||||
.blockingGet()
|
||||
.also { result ->
|
||||
val action = when (eventType) {
|
||||
TherapyEvent.Type.CANNULA_CHANGE.text -> Action.SITE_CHANGE
|
||||
TherapyEvent.Type.INSULIN_CHANGE.text -> Action.RESERVOIR_CHANGE
|
||||
else -> Action.CAREPORTAL
|
||||
}
|
||||
result.inserted.forEach {
|
||||
uel.log(Action.CAREPORTAL, Sources.NSClient,
|
||||
uel.log(action, Sources.NSClient,
|
||||
it.note ?: "",
|
||||
ValueWithUnit.Timestamp(it.timestamp),
|
||||
ValueWithUnit.TherapyEventType(it.type)
|
||||
|
@ -225,7 +230,7 @@ class NSClientAddUpdateWorker(
|
|||
.blockingGet()
|
||||
.also { result ->
|
||||
result.inserted.forEach {
|
||||
uel.log(Action.CAREPORTAL, Sources.NSClient,
|
||||
uel.log(Action.TEMP_BASAL, Sources.NSClient,
|
||||
ValueWithUnit.Timestamp(it.timestamp),
|
||||
ValueWithUnit.UnitPerHour(it.rate),
|
||||
ValueWithUnit.Minute(TimeUnit.MILLISECONDS.toMinutes(it.duration).toInt())
|
||||
|
@ -233,7 +238,7 @@ class NSClientAddUpdateWorker(
|
|||
aapsLogger.debug(LTag.DATABASE, "Inserted TemporaryBasal $it")
|
||||
}
|
||||
result.invalidated.forEach {
|
||||
uel.log(Action.CAREPORTAL, Sources.NSClient,
|
||||
uel.log(Action.TEMP_BASAL_REMOVED, Sources.NSClient,
|
||||
ValueWithUnit.Timestamp(it.timestamp),
|
||||
ValueWithUnit.UnitPerHour(it.rate),
|
||||
ValueWithUnit.Minute(TimeUnit.MILLISECONDS.toMinutes(it.duration).toInt())
|
||||
|
@ -241,7 +246,7 @@ class NSClientAddUpdateWorker(
|
|||
aapsLogger.debug(LTag.DATABASE, "Invalidated TemporaryBasal $it")
|
||||
}
|
||||
result.ended.forEach {
|
||||
uel.log(Action.CAREPORTAL, Sources.NSClient,
|
||||
uel.log(Action.CANCEL_TEMP_BASAL, Sources.NSClient,
|
||||
ValueWithUnit.Timestamp(it.timestamp),
|
||||
ValueWithUnit.UnitPerHour(it.rate),
|
||||
ValueWithUnit.Minute(TimeUnit.MILLISECONDS.toMinutes(it.duration).toInt())
|
||||
|
@ -263,24 +268,27 @@ class NSClientAddUpdateWorker(
|
|||
.blockingGet()
|
||||
.also { result ->
|
||||
result.inserted.forEach {
|
||||
uel.log(Action.CAREPORTAL, Sources.NSClient,
|
||||
uel.log(Action.EXTENDED_BOLUS, Sources.NSClient,
|
||||
ValueWithUnit.Timestamp(it.timestamp),
|
||||
ValueWithUnit.Insulin(it.amount),
|
||||
ValueWithUnit.UnitPerHour(it.rate),
|
||||
ValueWithUnit.Minute(TimeUnit.MILLISECONDS.toMinutes(it.duration).toInt())
|
||||
)
|
||||
aapsLogger.debug(LTag.DATABASE, "Inserted ExtendedBolus $it")
|
||||
}
|
||||
result.invalidated.forEach {
|
||||
uel.log(Action.CAREPORTAL, Sources.NSClient,
|
||||
uel.log(Action.EXTENDED_BOLUS_REMOVED, Sources.NSClient,
|
||||
ValueWithUnit.Timestamp(it.timestamp),
|
||||
ValueWithUnit.Insulin(it.amount),
|
||||
ValueWithUnit.UnitPerHour(it.rate),
|
||||
ValueWithUnit.Minute(TimeUnit.MILLISECONDS.toMinutes(it.duration).toInt())
|
||||
)
|
||||
aapsLogger.debug(LTag.DATABASE, "Invalidated ExtendedBolus $it")
|
||||
}
|
||||
result.ended.forEach {
|
||||
uel.log(Action.CAREPORTAL, Sources.NSClient,
|
||||
uel.log(Action.CANCEL_EXTENDED_BOLUS, Sources.NSClient,
|
||||
ValueWithUnit.Timestamp(it.timestamp),
|
||||
ValueWithUnit.Insulin(it.amount),
|
||||
ValueWithUnit.UnitPerHour(it.rate),
|
||||
ValueWithUnit.Minute(TimeUnit.MILLISECONDS.toMinutes(it.duration).toInt())
|
||||
)
|
||||
|
|
|
@ -334,10 +334,10 @@ class TreatmentsBolusCarbsFragment : DaggerFragment() {
|
|||
resourceHelper.gs(R.string.date) + ": " + dateUtil.dateAndTimeString(bolus.timestamp)
|
||||
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.removerecord), text, Runnable {
|
||||
uel.log(
|
||||
Action.TREATMENT_REMOVED, Sources.Treatments,
|
||||
Action.BOLUS_REMOVED, Sources.Treatments,
|
||||
ValueWithUnit.Timestamp(bolus.timestamp),
|
||||
ValueWithUnit.Insulin(bolus.amount)
|
||||
//XXXValueWithUnit.Gram(mealLinkLoaded.carbs.toInt())
|
||||
//ValueWithUnit.Gram(mealLinkLoaded.carbs.toInt())
|
||||
)
|
||||
disposable += repository.runTransactionForResult(InvalidateBolusTransaction(bolus.id))
|
||||
.subscribe(
|
||||
|
@ -356,7 +356,7 @@ class TreatmentsBolusCarbsFragment : DaggerFragment() {
|
|||
resourceHelper.gs(R.string.date) + ": " + dateUtil.dateAndTimeString(carb.timestamp)
|
||||
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.removerecord), text, Runnable {
|
||||
uel.log(
|
||||
Action.TREATMENT_REMOVED, Sources.Treatments,
|
||||
Action.CARBS_REMOVED, Sources.Treatments,
|
||||
ValueWithUnit.Timestamp(carb.timestamp),
|
||||
ValueWithUnit.Gram(carb.amount.toInt()))
|
||||
disposable += repository.runTransactionForResult(InvalidateCarbsTransaction(carb.id))
|
||||
|
|
|
@ -170,7 +170,7 @@ class TreatmentsTemporaryBasalsFragment : DaggerFragment() {
|
|||
${resourceHelper.gs(R.string.date)}: ${dateUtil.dateAndTimeString(tempBasal.timestamp)}
|
||||
""".trimIndent(),
|
||||
{ _: DialogInterface?, _: Int ->
|
||||
uel.log(Action.TT_REMOVED, Sources.Treatments,
|
||||
uel.log(Action.TEMP_BASAL_REMOVED, Sources.Treatments,
|
||||
ValueWithUnit.Timestamp(tempBasal.timestamp))
|
||||
disposable += repository.runTransactionForResult(InvalidateTemporaryBasalTransaction(tempBasal.id))
|
||||
.subscribe(
|
||||
|
|
|
@ -61,6 +61,9 @@ class Translator @Inject internal constructor(
|
|||
Action.AUTOMATION_REMOVED -> resourceHelper.gs(R.string.uel_automation_removed)
|
||||
Action.BG_REMOVED -> resourceHelper.gs(R.string.uel_bg_removed)
|
||||
Action.CAREPORTAL_REMOVED -> resourceHelper.gs(R.string.uel_careportal_removed)
|
||||
Action.BOLUS_REMOVED -> resourceHelper.gs(R.string.uel_bolus_removed)
|
||||
Action.CARBS_REMOVED -> resourceHelper.gs(R.string.uel_carbs_removed)
|
||||
Action.TEMP_BASAL_REMOVED -> resourceHelper.gs(R.string.uel_temp_basal_removed)
|
||||
Action.EXTENDED_BOLUS_REMOVED -> resourceHelper.gs(R.string.uel_extended_bolus_removed)
|
||||
Action.FOOD -> resourceHelper.gs(R.string.uel_food)
|
||||
Action.FOOD_REMOVED -> resourceHelper.gs(R.string.uel_food_removed)
|
||||
|
|
|
@ -106,8 +106,7 @@ class UserEntryPresentationHelper @Inject constructor(
|
|||
is ValueWithUnit.UnitPerHour -> DecimalFormatter.to2Decimal(valueWithUnit.value) + translator.translate(valueWithUnit)
|
||||
is ValueWithUnit.SimpleInt -> valueWithUnit.value.toString()
|
||||
is ValueWithUnit.SimpleString -> valueWithUnit.value
|
||||
is ValueWithUnit.StringResource -> resourceHelper.gs(valueWithUnit.value, *(valueWithUnit.params.map { it.value() }.toTypedArray())) //Todo Fix StringResource with Param
|
||||
// is XXXValueWithUnit.StringResource -> if (valueWithUnit.params.size > 0 ) valueWithUnit.params.joinToString(separator = " ") { value -> toPresentationString(value) } else resourceHelper.gs(valueWithUnit.value) //To help debugging
|
||||
is ValueWithUnit.StringResource -> resourceHelper.gs(valueWithUnit.value, *(valueWithUnit.params.map { it.value() }.toTypedArray()))
|
||||
is ValueWithUnit.TherapyEventMeterType -> translator.translate(valueWithUnit.value)
|
||||
is ValueWithUnit.TherapyEventTTReason -> translator.translate(valueWithUnit.value)
|
||||
is ValueWithUnit.TherapyEventType -> translator.translate(valueWithUnit.value)
|
||||
|
|
|
@ -444,6 +444,9 @@
|
|||
<string name="uel_automation_removed">AUTOMATION REMOVED</string>
|
||||
<string name="uel_bg_removed">BG REMOVED</string>
|
||||
<string name="uel_careportal_removed">CAREPORTAL REMOVED</string>
|
||||
<string name="uel_bolus_removed">BOLUS REMOVED</string>
|
||||
<string name="uel_carbs_removed">CARBS REMOVED</string>
|
||||
<string name="uel_temp_basal_removed">TEMP BASAL REMOVED</string>
|
||||
<string name="uel_extended_bolus_removed">EXTENDED BOLUS REMOVED</string>
|
||||
<string name="uel_food">FOOD</string>
|
||||
<string name="uel_food_removed">FOOD REMOVED</string>
|
||||
|
|
|
@ -67,6 +67,9 @@ data class UserEntry(
|
|||
PROFILE_SWITCH_REMOVED (ColorGroup.Aaps),
|
||||
RESTART_EVENTS_REMOVED (ColorGroup.Aaps),
|
||||
TREATMENT_REMOVED (ColorGroup.Aaps),
|
||||
BOLUS_REMOVED (ColorGroup.Aaps),
|
||||
CARBS_REMOVED (ColorGroup.Aaps),
|
||||
TEMP_BASAL_REMOVED (ColorGroup.Aaps),
|
||||
TT_REMOVED (ColorGroup.Aaps),
|
||||
NS_PAUSED (ColorGroup.Aaps),
|
||||
NS_RESUME (ColorGroup.Aaps),
|
||||
|
|
Loading…
Reference in a new issue