NSClient: fix json parsing
This commit is contained in:
parent
b0736b5246
commit
5aa1d988b1
1 changed files with 5 additions and 13 deletions
|
@ -66,20 +66,12 @@ fun temporaryTargetFromJson(jsonObject: JSONObject): TemporaryTarget? {
|
||||||
|
|
||||||
if (duration > 0L) {
|
if (duration > 0L) {
|
||||||
// not ending event
|
// not ending event
|
||||||
if (units == GlucoseUnit.MMOL) {
|
|
||||||
if (low < Constants.MIN_TT_MMOL) return null
|
|
||||||
if (low > Constants.MAX_TT_MMOL) return null
|
|
||||||
if (high < Constants.MIN_TT_MMOL) return null
|
|
||||||
if (high > Constants.MAX_TT_MMOL) return null
|
|
||||||
if (low > high) return null
|
|
||||||
} else {
|
|
||||||
if (low < Constants.MIN_TT_MGDL) return null
|
if (low < Constants.MIN_TT_MGDL) return null
|
||||||
if (low > Constants.MAX_TT_MGDL) return null
|
if (low > Constants.MAX_TT_MGDL) return null
|
||||||
if (high < Constants.MIN_TT_MGDL) return null
|
if (high < Constants.MIN_TT_MGDL) return null
|
||||||
if (high > Constants.MAX_TT_MGDL) return null
|
if (high > Constants.MAX_TT_MGDL) return null
|
||||||
if (low > high) return null
|
if (low > high) return null
|
||||||
}
|
}
|
||||||
}
|
|
||||||
val tt = TemporaryTarget(
|
val tt = TemporaryTarget(
|
||||||
timestamp = timestamp,
|
timestamp = timestamp,
|
||||||
duration = durationInMilliseconds ?: T.mins(duration).msecs(),
|
duration = durationInMilliseconds ?: T.mins(duration).msecs(),
|
||||||
|
|
Loading…
Reference in a new issue