-
Notifications
You must be signed in to change notification settings - Fork 4
[LOOP-5925] Preserve scheduled basal rate in insulin delivery cache #746
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Changes from 4 commits
114e603
430ce2f
95ef01a
8fa9038
6584485
342282f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -276,7 +276,8 @@ extension CachedInsulinDeliveryObject { | |
| self.endDate = entry.endDate | ||
| self.syncIdentifier = entry.syncIdentifier | ||
| self.deliveredUnits = entry.unitsInDeliverableIncrements | ||
| self.scheduledBasalRate = entry.scheduledBasalRate | ||
| // A `.basal` dose's rate is its `value`; preserve it as the rate field so the cache reports the exact rate instead of one derived from a quantized delivered total. | ||
| self.scheduledBasalRate = entry.scheduledBasalRate ?? (entry.type == .basal ? LoopQuantity(unit: .internationalUnitsPerHour, doubleValue: entry.unitsPerHour) : nil) | ||
| self.programmedTempBasalRate = (entry.type == .tempBasal) ? LoopQuantity(unit: .internationalUnitsPerHour, doubleValue: entry.unitsPerHour) : nil | ||
| self.programmedUnits = (entry.type == .bolus) ? entry.programmedUnits : nil | ||
| self.reason = (entry.type == .bolus) ? .bolus : .basal | ||
|
|
@@ -302,7 +303,8 @@ extension CachedInsulinDeliveryObject { | |
| self.endDate = entry.endDate | ||
| self.syncIdentifier = entry.syncIdentifier | ||
| self.deliveredUnits = entry.unitsInDeliverableIncrements | ||
| self.scheduledBasalRate = entry.scheduledBasalRate | ||
| // A `.basal` dose's rate is its `value`; preserve it as the rate field so the cache reports the exact rate instead of one derived from a quantized delivered total. | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [nit] comment calls out
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See above.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll update the comments to make that clear. |
||
| self.scheduledBasalRate = entry.scheduledBasalRate ?? (entry.type == .basal ? LoopQuantity(unit: .internationalUnitsPerHour, doubleValue: entry.unitsPerHour) : nil) | ||
| self.programmedTempBasalRate = (entry.type == .tempBasal) ? LoopQuantity(unit: .internationalUnitsPerHour, doubleValue: entry.unitsPerHour) : nil | ||
| self.programmedUnits = (entry.type == .bolus) ? entry.programmedUnits : nil | ||
| self.reason = (entry.type == .bolus) ? .bolus : .basal | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nit] comment calls out
valuebut the code doesn't use that propertyThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
unitsPerHouraccessor does usevalue