Skip to content

Commit

Permalink
[CPA-62] Remove trendRateUnit from Glucose Store
Browse files Browse the repository at this point in the history
  • Loading branch information
Camji55 committed Jul 17, 2023
1 parent 6f3a067 commit b81f889
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 2 additions & 3 deletions Common/Models/StatusExtensionContext.swift
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@ extension GlucoseDisplayableContext: RawRepresentable {
trendType = nil
}

if let trendRateUnit = rawValue["trendRateUnit"] as? String, let trendRateValue = rawValue["trendRateValue"] as? Double {
trendRate = HKQuantity(unit: HKUnit(from: trendRateUnit), doubleValue: trendRateValue)
if let trendRateValue = rawValue["trendRateValue"] as? Double {
trendRate = HKQuantity(unit: .milligramsPerDeciliterPerMinute, doubleValue: trendRateValue)
} else {
trendRate = nil
}
Expand All @@ -181,7 +181,6 @@ extension GlucoseDisplayableContext: RawRepresentable {
]
raw["trendType"] = trendType?.rawValue
if let trendRate = trendRate {
raw["trendRateUnit"] = HKUnit.milligramsPerDeciliterPerMinute.unitString
raw["trendRateValue"] = trendRate.doubleValue(for: HKUnit.milligramsPerDeciliterPerMinute)
}
raw["glucoseRangeCategory"] = glucoseRangeCategory?.rawValue
Expand Down
4 changes: 2 additions & 2 deletions Common/Models/WatchContext.swift
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ final class WatchContext: RawRepresentable {
if let rawGlucoseTrend = rawValue["gt"] as? GlucoseTrend.RawValue {
glucoseTrend = GlucoseTrend(rawValue: rawGlucoseTrend)
}
if let glucoseTrendRateUnitString = rawValue["gtru"] as? String, let glucoseTrendRateValue = rawValue["gtrv"] as? Double {
glucoseTrendRate = HKQuantity(unit: HKUnit(from: glucoseTrendRateUnitString), doubleValue: glucoseTrendRateValue)
if let glucoseTrendRateValue = rawValue["gtrv"] as? Double {
glucoseTrendRate = HKQuantity(unit: .milligramsPerDeciliterPerMinute, doubleValue: glucoseTrendRateValue)
}
glucoseDate = rawValue["gd"] as? Date
glucoseIsDisplayOnly = rawValue["gdo"] as? Bool
Expand Down

0 comments on commit b81f889

Please sign in to comment.