diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/CarbsDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/CarbsDialog.kt index bd2a5fdea2..328c52ddea 100644 --- a/app/src/main/java/info/nightscout/androidaps/dialogs/CarbsDialog.kt +++ b/app/src/main/java/info/nightscout/androidaps/dialogs/CarbsDialog.kt @@ -250,7 +250,10 @@ class CarbsDialog : DialogFragmentWithDate() { } if (carbsAfterConstraints > 0) { if (duration == 0) { - uel.log(Action.CARBS, notes, ValueWithUnit(carbsAfterConstraints.toDouble(), Units.G), ValueWithUnit(timeOffset, Units.M)) + if (eventTimeChanged) + uel.log(Action.CARBS, notes, ValueWithUnit(eventTime, Units.Timestamp), ValueWithUnit(carbsAfterConstraints.toDouble(), Units.G), ValueWithUnit(timeOffset, Units.M)) + else + uel.log(Action.CARBS, notes, ValueWithUnit(carbsAfterConstraints.toDouble(), Units.G), ValueWithUnit(timeOffset, Units.M)) carbsGenerator.createCarb(carbsAfterConstraints, time, CareportalEvent.CARBCORRECTION, notes) } else { uel.log(Action.CARBS, notes, ValueWithUnit(carbsAfterConstraints.toDouble(), Units.G), ValueWithUnit(timeOffset,Units.M), ValueWithUnit(duration, Units.H)) diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/CareDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/CareDialog.kt index f558c8029d..1121681949 100644 --- a/app/src/main/java/info/nightscout/androidaps/dialogs/CareDialog.kt +++ b/app/src/main/java/info/nightscout/androidaps/dialogs/CareDialog.kt @@ -223,7 +223,10 @@ class CareDialog : DialogFragmentWithDate() { EventType.ANNOUNCEMENT -> CareportalEvent.ANNOUNCEMENT } careportalEvent.json = json.toString() - uel.log(Action.CAREPORTAL, notes, ValueWithUnit(careportalEvent.eventType, Units.CPEvent)) + if (eventTimeChanged) + uel.log(Action.CAREPORTAL, notes, ValueWithUnit(eventTime, Units.Timestamp), ValueWithUnit(careportalEvent.eventType, Units.CPEvent)) + else + uel.log(Action.CAREPORTAL, notes, ValueWithUnit(careportalEvent.eventType, Units.CPEvent)) MainApp.getDbHelper().createOrUpdate(careportalEvent) nsUpload.uploadCareportalEntryToNS(json) }, null) diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/ProfileSwitchDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/ProfileSwitchDialog.kt index 5b294b7ff1..1fd0c158cd 100644 --- a/app/src/main/java/info/nightscout/androidaps/dialogs/ProfileSwitchDialog.kt +++ b/app/src/main/java/info/nightscout/androidaps/dialogs/ProfileSwitchDialog.kt @@ -125,7 +125,10 @@ class ProfileSwitchDialog : DialogFragmentWithDate() { activity?.let { activity -> OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.careportal_profileswitch), HtmlHelper.fromHtml(Joiner.on("
").join(actions)), { - uel.log(Action.PROFILE_SWITCH, notes, ValueWithUnit(percent, Units.Percent), ValueWithUnit(timeShift, Units.H), ValueWithUnit(duration, Units.M)) + if (eventTimeChanged) + uel.log(Action.PROFILE_SWITCH, notes, ValueWithUnit(eventTime, Units.Timestamp), ValueWithUnit(percent, Units.Percent), ValueWithUnit(timeShift, Units.H), ValueWithUnit(duration, Units.M)) + else + uel.log(Action.PROFILE_SWITCH, notes, ValueWithUnit(percent, Units.Percent), ValueWithUnit(timeShift, Units.H), ValueWithUnit(duration, Units.M)) treatmentsPlugin.doProfileSwitch(profileStore, profile, duration, percent, timeShift, eventTime) }) } diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/TempTargetDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/TempTargetDialog.kt index c7e364ae96..84a8ab9e42 100644 --- a/app/src/main/java/info/nightscout/androidaps/dialogs/TempTargetDialog.kt +++ b/app/src/main/java/info/nightscout/androidaps/dialogs/TempTargetDialog.kt @@ -168,13 +168,22 @@ class TempTargetDialog : DialogFragmentWithDate() { activity?.let { activity -> OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.careportal_temporarytarget), HtmlHelper.fromHtml(Joiner.on("
").join(actions)), { val units = profileFunction.getUnits() - when(reason) { - resourceHelper.gs(R.string.eatingsoon) -> uel.log(Action.TT_EATING_SOON, ValueWithUnit(target, units), ValueWithUnit(duration, Units.M)) - resourceHelper.gs(R.string.activity) -> uel.log(Action.TT_ACTIVITY, ValueWithUnit(target, units), ValueWithUnit(duration, Units.M)) - resourceHelper.gs(R.string.hypo) -> uel.log(Action.TT_HYPO, ValueWithUnit(target, units), ValueWithUnit(duration, Units.M)) - resourceHelper.gs(R.string.manual) -> uel.log(Action.TT, ValueWithUnit(target, units), ValueWithUnit(duration, Units.M)) - resourceHelper.gs(R.string.stoptemptarget) -> uel.log(Action.CANCEL_TT) - } + if (eventTimeChanged) + when(reason) { + resourceHelper.gs(R.string.eatingsoon) -> uel.log(Action.TT_EATING_SOON, ValueWithUnit(eventTime, Units.Timestamp), ValueWithUnit(target, units), ValueWithUnit(duration, Units.M)) + resourceHelper.gs(R.string.activity) -> uel.log(Action.TT_ACTIVITY, ValueWithUnit(eventTime, Units.Timestamp), ValueWithUnit(target, units), ValueWithUnit(duration, Units.M)) + resourceHelper.gs(R.string.hypo) -> uel.log(Action.TT_HYPO, ValueWithUnit(eventTime, Units.Timestamp), ValueWithUnit(target, units), ValueWithUnit(duration, Units.M)) + resourceHelper.gs(R.string.manual) -> uel.log(Action.TT, ValueWithUnit(eventTime, Units.Timestamp), ValueWithUnit(target, units), ValueWithUnit(duration, Units.M)) + resourceHelper.gs(R.string.stoptemptarget) -> uel.log(Action.CANCEL_TT, ValueWithUnit(eventTime, Units.Timestamp)) + } + else + when(reason) { + resourceHelper.gs(R.string.eatingsoon) -> uel.log(Action.TT_EATING_SOON, ValueWithUnit(target, units), ValueWithUnit(duration, Units.M)) + resourceHelper.gs(R.string.activity) -> uel.log(Action.TT_ACTIVITY, ValueWithUnit(target, units), ValueWithUnit(duration, Units.M)) + resourceHelper.gs(R.string.hypo) -> uel.log(Action.TT_HYPO, ValueWithUnit(target, units), ValueWithUnit(duration, Units.M)) + resourceHelper.gs(R.string.manual) -> uel.log(Action.TT, ValueWithUnit(target, units), ValueWithUnit(duration, Units.M)) + resourceHelper.gs(R.string.stoptemptarget) -> uel.log(Action.CANCEL_TT) + } if (target == 0.0 || duration == 0) { val tempTarget = TempTarget() .date(eventTime)