Skip to content

Commit 9990b81

Browse files
authored
Merge pull request nightscout#1055 from nightscout/fix-manual-readings-smoothing
Include manual readings for algorithm glucose always
2 parents dc81937 + 71ce737 commit 9990b81

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

Trio/Sources/APS/OpenAPS/OpenAPS.swift

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,14 @@ final class OpenAPS {
132132

133133
return glucoseResults.map { glucose -> AlgorithmGlucose in
134134
let glucoseValue: Int16
135-
if shouldSmoothGlucose, !glucose.isManual, let smoothedGlucose = glucose.smoothedGlucose, smoothedGlucose != 0 {
136-
glucoseValue = smoothedGlucose.rounding(accordingToBehavior: roundingBehavior).int16Value
135+
if shouldSmoothGlucose {
136+
if !glucose.isManual, let smoothedGlucose = glucose.smoothedGlucose, smoothedGlucose != 0 {
137+
glucoseValue = smoothedGlucose.rounding(accordingToBehavior: roundingBehavior).int16Value
138+
} else {
139+
// use the raw value = finger prick, so manual readings are always included for algorithm decision making
140+
// cf. https://github.com/nightscout/Trio/issues/1054
141+
glucoseValue = glucose.glucose
142+
}
137143
} else {
138144
glucoseValue = glucose.glucose
139145
}

0 commit comments

Comments
 (0)