diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/source/DexcomPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/source/DexcomPlugin.kt index 2f4f7d935e..abc783856b 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/source/DexcomPlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/source/DexcomPlugin.kt @@ -161,12 +161,17 @@ class DexcomPlugin @Inject constructor( ValueWithUnit.TherapyEventType(it.type)) aapsLogger.debug(LTag.DATABASE, "Inserted sensor insertion $it") } - result.calibrationsInserted.forEach { - uel.log(Action.CAREPORTAL, - Sources.Dexcom, - ValueWithUnit.Timestamp(it.timestamp), - ValueWithUnit.TherapyEventType(it.type)) - aapsLogger.debug(LTag.DATABASE, "Inserted calibration $it") + result.calibrationsInserted.forEach { calibration -> + calibration.glucose?.let { glucosevalue -> + uel.log( + Action.CAREPORTAL, + Sources.Dexcom, + ValueWithUnit.Timestamp(calibration.timestamp), + ValueWithUnit.TherapyEventType(calibration.type), + ValueWithUnit.fromGlucoseUnit(glucosevalue, calibration.glucoseUnit.toString()) + ) + } + aapsLogger.debug(LTag.DATABASE, "Inserted calibration $calibration") } } } catch (e: Exception) { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/source/GlunovoPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/source/GlunovoPlugin.kt index 97c07f815a..e7d52cd536 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/source/GlunovoPlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/source/GlunovoPlugin.kt @@ -10,6 +10,8 @@ import info.nightscout.androidaps.R import info.nightscout.androidaps.database.AppRepository import info.nightscout.androidaps.database.entities.GlucoseValue import info.nightscout.androidaps.database.entities.TherapyEvent +import info.nightscout.androidaps.database.entities.UserEntry +import info.nightscout.androidaps.database.entities.ValueWithUnit import info.nightscout.androidaps.database.transactions.CgmSourceTransaction import info.nightscout.androidaps.interfaces.BgSource import info.nightscout.androidaps.interfaces.PluginBase @@ -17,6 +19,7 @@ import info.nightscout.androidaps.interfaces.PluginDescription import info.nightscout.androidaps.interfaces.PluginType import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.LTag +import info.nightscout.androidaps.logging.UserEntryLogger import info.nightscout.androidaps.utils.DateUtil import info.nightscout.androidaps.utils.FabricPrivacy import info.nightscout.androidaps.utils.T @@ -37,6 +40,7 @@ class GlunovoPlugin @Inject constructor( private val repository: AppRepository, private val xDripBroadcast: XDripBroadcast, private val dateUtil: DateUtil, + private val uel: UserEntryLogger, private val fabricPrivacy: FabricPrivacy ) : PluginBase( PluginDescription() @@ -146,6 +150,18 @@ class GlunovoPlugin @Inject constructor( xDripBroadcast.send(it) aapsLogger.debug(LTag.DATABASE, "Inserted bg $it") } + savedValues.calibrationsInserted.forEach { calibration -> + calibration.glucose?.let { glucosevalue -> + uel.log( + UserEntry.Action.CAREPORTAL, + UserEntry.Sources.Dexcom, + ValueWithUnit.Timestamp(calibration.timestamp), + ValueWithUnit.TherapyEventType(calibration.type), + ValueWithUnit.fromGlucoseUnit(glucosevalue, calibration.glucoseUnit.toString()) + ) + } + aapsLogger.debug(LTag.DATABASE, "Inserted calibration $calibration") + } } } }