preserve invalidated status for cgm data
This commit is contained in:
parent
3d94f3f840
commit
4c4122c6a6
1 changed files with 5 additions and 2 deletions
|
@ -27,11 +27,14 @@ class CgmSourceTransaction(
|
||||||
noise = it.noise,
|
noise = it.noise,
|
||||||
trendArrow = it.trendArrow,
|
trendArrow = it.trendArrow,
|
||||||
sourceSensor = it.sourceSensor
|
sourceSensor = it.sourceSensor
|
||||||
)
|
).also { gv ->
|
||||||
glucoseValue.interfaceIDs.nightscoutId = it.nightscoutId
|
gv.interfaceIDs.nightscoutId = it.nightscoutId
|
||||||
|
}
|
||||||
// if nsId is not provided in new record, copy from current if exists
|
// if nsId is not provided in new record, copy from current if exists
|
||||||
if (glucoseValue.interfaceIDs.nightscoutId == null)
|
if (glucoseValue.interfaceIDs.nightscoutId == null)
|
||||||
current?.let { existing -> glucoseValue.interfaceIDs.nightscoutId = existing.interfaceIDs.nightscoutId }
|
current?.let { existing -> glucoseValue.interfaceIDs.nightscoutId = existing.interfaceIDs.nightscoutId }
|
||||||
|
// preserve invalidated status (user may delete record in UI)
|
||||||
|
current?.let { existing -> glucoseValue.isValid = existing.isValid }
|
||||||
when {
|
when {
|
||||||
// new record, create new
|
// new record, create new
|
||||||
current == null -> {
|
current == null -> {
|
||||||
|
|
Loading…
Reference in a new issue