@@ -63,32 +63,35 @@ class SiteNSNowTableViewCell: UITableViewCell {
63
63
siteLastReadingLabel. text = watchEntry. dateTimeAgoString
64
64
65
65
if let sgvValue = watchEntry. sgv {
66
- let color = colorForDesiredColorState ( site. configuration!. boundedColorForGlucoseValue ( sgvValue. sgv) )
66
+
67
+ var boundedColor = configuration. boundedColorForGlucoseValue ( sgvValue. sgv)
68
+ if units == . Mmol {
69
+ boundedColor = configuration. boundedColorForGlucoseValue ( sgvValue. sgv. toMgdl)
70
+ }
71
+ let color = colorForDesiredColorState ( boundedColor)
72
+
67
73
siteColorBlockView. backgroundColor = color
74
+
68
75
siteSgvLabel. text = " \( sgvValue. sgvString) \( sgvValue. direction. emojiForDirection) "
69
76
siteSgvLabel. textColor = color
70
77
71
78
siteDirectionLabel. text = " \( watchEntry. bgdelta. formattedForBGDelta) \( units. description) "
72
79
siteDirectionLabel. textColor = color
80
+
73
81
74
82
if let enabledOptions = configuration. enabledOptions {
75
83
let rawEnabled = contains ( enabledOptions, EnabledOptions . rawbg)
76
84
if rawEnabled {
77
85
if let rawValue = watchEntry. raw {
78
86
let color = colorForDesiredColorState ( configuration. boundedColorForGlucoseValue ( rawValue) )
79
87
80
- let numberFormatter = NSNumberFormatter ( )
81
- var raw = rawValue
88
+ var raw = " \( rawValue. formattedForMgdl) "
82
89
if configuration. displayUnits == . Mmol {
83
- raw = rawValue. toMmol
84
- numberFormatter. numberStyle = . DecimalStyle
85
- numberFormatter. minimumFractionDigits = 1
86
- numberFormatter. maximumFractionDigits = 1
87
- numberFormatter. secondaryGroupingSize = 1
90
+ raw = rawValue. formattedForMmol
88
91
}
89
92
90
93
siteRawLabel? . textColor = color
91
- siteRawLabel. text = " \( numberFormatter . stringFromNumber ( raw) ! ) : \( sgvValue. noise) "
94
+ siteRawLabel. text = " \( raw) : \( sgvValue. noise) "
92
95
}
93
96
} else {
94
97
siteRawHeader. hidden = true
0 commit comments