Merge pull request #1030 from Philoul/Fix/UserEntryUnitsConvertion
User entry Add Glucose Value in TherapyEvents NSClient
This commit is contained in:
commit
2ec9517b02
1 changed files with 12 additions and 10 deletions
|
@ -274,21 +274,23 @@ class NSClientAddUpdateWorker(
|
||||||
TherapyEvent.Type.INSULIN_CHANGE.text -> Action.RESERVOIR_CHANGE
|
TherapyEvent.Type.INSULIN_CHANGE.text -> Action.RESERVOIR_CHANGE
|
||||||
else -> Action.CAREPORTAL
|
else -> Action.CAREPORTAL
|
||||||
}
|
}
|
||||||
result.inserted.forEach {
|
result.inserted.forEach { therapyEvent ->
|
||||||
uel.log(action, Sources.NSClient,
|
uel.log(action, Sources.NSClient,
|
||||||
it.note ?: "",
|
therapyEvent.note ?: "",
|
||||||
ValueWithUnit.Timestamp(it.timestamp),
|
ValueWithUnit.Timestamp(therapyEvent.timestamp),
|
||||||
ValueWithUnit.TherapyEventType(it.type)
|
ValueWithUnit.TherapyEventType(therapyEvent.type),
|
||||||
|
ValueWithUnit.fromGlucoseUnit(therapyEvent.glucose ?:0.0,therapyEvent.glucoseUnit.toString).takeIf { therapyEvent.glucose != null }
|
||||||
)
|
)
|
||||||
aapsLogger.debug(LTag.DATABASE, "Inserted TherapyEvent $it")
|
aapsLogger.debug(LTag.DATABASE, "Inserted TherapyEvent $therapyEvent")
|
||||||
}
|
}
|
||||||
result.invalidated.forEach {
|
result.invalidated.forEach { therapyEvent ->
|
||||||
uel.log(Action.CAREPORTAL_REMOVED, Sources.NSClient,
|
uel.log(Action.CAREPORTAL_REMOVED, Sources.NSClient,
|
||||||
it.note ?: "",
|
therapyEvent.note ?: "",
|
||||||
ValueWithUnit.Timestamp(it.timestamp),
|
ValueWithUnit.Timestamp(therapyEvent.timestamp),
|
||||||
ValueWithUnit.TherapyEventType(it.type)
|
ValueWithUnit.TherapyEventType(therapyEvent.type),
|
||||||
|
ValueWithUnit.fromGlucoseUnit(therapyEvent.glucose ?:0.0, therapyEvent.glucoseUnit.toString).takeIf { therapyEvent.glucose != null }
|
||||||
)
|
)
|
||||||
aapsLogger.debug(LTag.DATABASE, "Invalidated TherapyEvent $it")
|
aapsLogger.debug(LTag.DATABASE, "Invalidated TherapyEvent $therapyEvent")
|
||||||
}
|
}
|
||||||
result.updatedNsId.forEach {
|
result.updatedNsId.forEach {
|
||||||
aapsLogger.debug(LTag.DATABASE, "Updated nsId TherapyEvent $it")
|
aapsLogger.debug(LTag.DATABASE, "Updated nsId TherapyEvent $it")
|
||||||
|
|
Loading…
Reference in a new issue