File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -147,11 +147,11 @@ class AlarmRule {
147147 if currentReading. value < persistentHighUpperBound. value {
148148
149149 // if all the previous readings (for the defined minutes are high, we'll consider it a persistent high)
150- let lastReadingValues = bloodValues. lastXMinutes ( persistentHighMinutes. value) . map { Double ( $0 . value ) }
150+ let lastReadings = bloodValues. lastXMinutes ( persistentHighMinutes. value)
151151
152152 // we should have at least a reading in 10 minutes for considering a persistent high
153- if !lastReadingValues . isEmpty && ( lastReadingValues . count >= ( persistentHighMinutes. value / 10 ) ) {
154- if AlarmRule . isTooHigh ( Float ( lastReadingValues . average ) ) {
153+ if !lastReadings . isEmpty && ( lastReadings . count >= ( persistentHighMinutes. value / 10 ) ) {
154+ if lastReadings . allSatisfy ( { AlarmRule . isTooHigh ( $0 . value ) } ) {
155155 return " Persistent High BG "
156156 } else {
157157 return nil
You can’t perform that action at this time.
0 commit comments