Dexcom: check for sensorStartTime validity
This commit is contained in:
parent
14641e85e6
commit
58b49a05ea
1 changed files with 5 additions and 1 deletions
|
@ -149,11 +149,15 @@ class DexcomPlugin @Inject constructor(
|
|||
sourceSensor = sourceSensor
|
||||
)
|
||||
}
|
||||
val sensorStartTime = if (sp.getBoolean(R.string.key_dexcom_lognssensorchange, false) && bundle.containsKey("sensorInsertionTime")) {
|
||||
var sensorStartTime = if (sp.getBoolean(R.string.key_dexcom_lognssensorchange, false) && bundle.containsKey("sensorInsertionTime")) {
|
||||
bundle.getLong("sensorInsertionTime", 0) * 1000
|
||||
} else {
|
||||
null
|
||||
}
|
||||
// check start time validity
|
||||
sensorStartTime?.let {
|
||||
if (abs(it - now) > T.months(1).msecs() || it > now) sensorStartTime = null
|
||||
}
|
||||
repository.runTransactionForResult(CgmSourceTransaction(glucoseValues, calibrations, sensorStartTime))
|
||||
.doOnError {
|
||||
aapsLogger.error(LTag.DATABASE, "Error while saving values from Dexcom App", it)
|
||||
|
|
Loading…
Reference in a new issue