Skip to content

Commit f851034

Browse files
authored
Merge pull request #568 from Lamercho/Lamercho/rename-fatty-meal
rename fatty meal to reduced bolus
2 parents 0090830 + 3a6aec0 commit f851034

File tree

7 files changed

+35
-33
lines changed

7 files changed

+35
-33
lines changed

Trio/Sources/Localizations/Main/Localizable.xcstrings

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86475,7 +86475,7 @@
8647586475
}
8647686476
}
8647786477
},
86478-
"Enable Fatty Meal Option" : {
86478+
"Enable Reduced Bolus Option" : {
8647986479
"localizations" : {
8648086480
"bg" : {
8648186481
"stringUnit" : {
@@ -90333,7 +90333,7 @@
9033390333
}
9033490334
}
9033590335
},
90336-
"Enabling this setting adds a \"Fatty Meal\" option to the bolus calculator. Once this feature is enabled, a percentage setting will appear for you to select." : {
90336+
"Enabling this setting adds a \"Reduced Bolus\" option to the bolus calculator. Once this feature is enabled, a percentage setting will appear for you to select." : {
9033790337
"localizations" : {
9033890338
"bg" : {
9033990339
"stringUnit" : {
@@ -98853,7 +98853,7 @@
9885398853
}
9885498854
}
9885598855
},
98856-
"Fatty Meal" : {
98856+
"Reduced Bolus" : {
9885798857
"comment" : "For the Bolus View pop-up",
9885898858
"localizations" : {
9885998859
"bg" : {
@@ -98960,7 +98960,7 @@
9896098960
}
9896198961
}
9896298962
},
98963-
"Fatty Meal Bolus Percentage" : {
98963+
"Reduced Bolus Percentage" : {
9896498964
"localizations" : {
9896598965
"bg" : {
9896698966
"stringUnit" : {
@@ -115671,7 +115671,7 @@
115671115671
}
115672115672
}
115673115673
},
115674-
"If you have a \"Recommended Bolus Percentage\" of 80%, and a \"Fatty Meal Bolus Percentage\" of 70%, your recommended bolus will be multiplied by: (80 × 70) / 100 = 56%." : {
115674+
"If you have a \"Recommended Bolus Percentage\" of 80%, and a \"Reduced Bolus Percentage\" of 70%, your recommended bolus will be multiplied by: (80 × 70) / 100 = 56%." : {
115675115675
"localizations" : {
115676115676
"bg" : {
115677115677
"stringUnit" : {
@@ -236319,7 +236319,7 @@
236319236319
}
236320236320
}
236321236321
},
236322-
"When \"Fatty Meal\" is selected in the bolus calculator, the recommended bolus will be multiplied by the \"Fatty Meal Bolus Percentage\" as well as the \"Recommended Bolus Percentage\"." : {
236322+
"When \"Reduced Bolus\" is selected in the bolus calculator, the recommended bolus will be multiplied by the \"Reduced Bolus Percentage\" as well as the \"Recommended Bolus Percentage\"." : {
236323236323
"localizations" : {
236324236324
"bg" : {
236325236325
"stringUnit" : {

Trio/Sources/Modules/BolusCalculatorConfig/View/BolusCalculatorConfigRootView.swift

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -93,29 +93,31 @@ extension BolusCalculatorConfig {
9393
get: { selectedVerboseHint },
9494
set: {
9595
selectedVerboseHint = $0.map { AnyView($0) }
96-
hintLabel = String(localized: "Fatty Meal")
96+
hintLabel = String(localized: "Reduced Bolus")
9797
}
9898
),
9999
units: state.units,
100100
type: .conditionalDecimal("fattyMealFactor"),
101-
label: String(localized: "Enable Fatty Meal Option"),
102-
conditionalLabel: String(localized: "Fatty Meal Bolus Percentage"),
101+
label: String(localized: "Enable Reduced Bolus Option"),
102+
conditionalLabel: String(localized: "Reduced Bolus Percentage"),
103103
miniHint: String(localized: "Add and set a bolus option for meals that absorb slowly."),
104104
verboseHint:
105105
VStack(alignment: .leading, spacing: 10) {
106106
Text("Default: OFF").bold()
107107
Text("Default Percent: 70%").bold()
108108
Text("Do not enable this feature until you have optimized your CR (carb ratio) setting.").bold()
109109
Text(
110-
"Enabling this setting adds a \"Fatty Meal\" option to the bolus calculator. Once this feature is enabled, a percentage setting will appear for you to select."
110+
"Enabling this setting adds a \"Reduced Bolus\" option to the bolus calculator. Once this feature is enabled, a percentage setting will appear for you to select."
111111
)
112112
Text(
113-
"When \"Fatty Meal\" is selected in the bolus calculator, the recommended bolus will be multiplied by the \"Fatty Meal Bolus Percentage\" as well as the \"Recommended Bolus Percentage\"."
113+
"When \"Reduced Bolus\" is selected in the bolus calculator, the recommended bolus will be multiplied by the \"Reduced Bolus Percentage\" as well as the \"Recommended Bolus Percentage\"."
114114
)
115115
Text(
116-
"If you have a \"Recommended Bolus Percentage\" of 80%, and a \"Fatty Meal Bolus Percentage\" of 70%, your recommended bolus will be multiplied by: (80 × 70) / 100 = 56%."
116+
"If you have a \"Recommended Bolus Percentage\" of 80%, and a \"Reduced Bolus Percentage\" of 70%, your recommended bolus will be multiplied by: (80 × 70) / 100 = 56%."
117+
)
118+
Text(
119+
"This is useful for slow-absorbing meals where high fat, protein, or fiber can delay carb absorption and cause a slower rise in blood sugar, so a reduced bolus helps match insulin to the delayed effect."
117120
)
118-
Text("This could be useful for slow absorbing meals like pizza.")
119121
}
120122
)
121123

Trio/Sources/Modules/Settings/SettingItems.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,8 @@ enum SettingItems {
180180
searchContents: [
181181
"Display Meal Presets",
182182
"Recommended Bolus Percentage",
183-
"Enable Fatty Meal Factor",
184-
"Fatty Meal Factor",
183+
"Enable Reduced Bolus Factor",
184+
"Reduced Bolus Factor",
185185
"Enable Super Bolus",
186186
"Super Bolus Factor",
187187
"Very Low Glucose Warning"

Trio/Sources/Modules/Treatments/View/PopupView.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -604,7 +604,7 @@ struct PopupView: View {
604604

605605
/// Card showing applied factors to the final insulin calculation.
606606
/// Dynamically changes card based on user's selection in the Treatment view.
607-
/// User can choose Fatty Meal, Super Bolus, or neither, but not both.
607+
/// User can choose Reduced Bolus, Super Bolus, or neither, but not both.
608608
private var factorsCardContent: some View {
609609
Grid(alignment: .center) {
610610
// Choose the layout based on which options are selected
@@ -646,7 +646,7 @@ struct PopupView: View {
646646
}
647647
.unitStyle()
648648

649-
// Case: Full Bolus × Rec. Bolus % × Fatty Meal %
649+
// Case: Full Bolus × Rec. Bolus % × Reduced Bolus %
650650
case (false, true):
651651
// Row 1: Header.
652652
GridRow(alignment: .lastTextBaseline) {
@@ -656,7 +656,7 @@ struct PopupView: View {
656656
Text("Rec. Bolus %")
657657
Text("")
658658
.layoutPriority(-15)
659-
Text("Fatty %")
659+
Text("Red. Bolus %")
660660
}
661661
.secondaryStyle()
662662

Trio/Sources/Modules/Treatments/View/TreatmentsRootView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ extension Treatments {
255255
HStack(spacing: 10) {
256256
if state.fattyMeals {
257257
Toggle(isOn: $state.useFattyMealCorrectionFactor) {
258-
Text("Fatty Meal")
258+
Text("Reduced Bolus")
259259
}
260260
.toggleStyle(RadioButtonToggleStyle())
261261
.font(.footnote)

Trio/Sources/Services/BolusCalculator/BolusCalculationManager.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -420,19 +420,19 @@ final class BaseBolusCalculationManager: BolusCalculationManager, Injectable {
420420
}
421421

422422
// apply custom factor at the end of the calculations
423-
// apply custom factor if fatty meal toggle in bolus calc config settings is on and the box for fatty meals is checked (in RootView)
423+
// apply custom factor if reduced bolus toggle in bolus calc config settings is on and the box for reduced bolus is checked (in RootView)
424424
var factoredInsulin = wholeCalc
425425
debug(.default, "Initial factored insulin: \(factoredInsulin)")
426426

427-
// Apply Recommended Bolus Percentage (input.fraction) and if selected apply Fatty Meal Bolus Percentage (input.fattyMealFactor)
427+
// Apply Recommended Bolus Percentage (input.fraction) and if selected apply Reduced Bolus Percentage (input.fattyMealFactor)
428428
// If factoredInsulin is negative, though, don't apply either
429429
if factoredInsulin > 0 {
430430
factoredInsulin *= input.fraction
431431
debug(.default, "After fraction (\(input.fraction)): \(factoredInsulin)")
432432

433433
if input.useFattyMealCorrectionFactor {
434434
factoredInsulin *= input.fattyMealFactor
435-
debug(.default, "After fatty meal factor (\(input.fattyMealFactor)): \(factoredInsulin)")
435+
debug(.default, "After reduced bolus factor (\(input.fattyMealFactor)): \(factoredInsulin)")
436436
}
437437
}
438438

@@ -488,7 +488,7 @@ final class BaseBolusCalculationManager: BolusCalculationManager, Injectable {
488488
/// Handles the complete bolus calculation process
489489
/// - Parameters:
490490
/// - carbs: Amount of carbohydrates to be consumed
491-
/// - useFattyMealCorrection: Whether to apply fatty meal correction
491+
/// - useFattyMealCorrection: Whether to apply reduced bolus correction
492492
/// - useSuperBolus: Whether to use super bolus calculation
493493
/// - minPredBG: Minimum Predicted Glucose determined by Oref
494494
/// - simulatedCOB: Optional simulated COB from backdated entries (if available)
@@ -546,8 +546,8 @@ struct CalculationInput: Sendable {
546546
let carbRatio: Decimal // Carb to insulin ratio
547547
let iob: Decimal // Insulin on Board
548548
let cob: Int16 // Carbs on Board
549-
let useFattyMealCorrectionFactor: Bool // Whether to apply fatty meal correction
550-
let fattyMealFactor: Decimal // Factor for fatty meal adjustment
549+
let useFattyMealCorrectionFactor: Bool // Whether to apply reduced bolus correction
550+
let fattyMealFactor: Decimal // Factor for reduced bolus adjustment
551551
let useSuperBolus: Bool // Whether to use super bolus calculation
552552
let sweetMealFactor: Decimal // Factor for sweet meal adjustment
553553
let basal: Decimal // Current basal rate

TrioTests/BolusCalculatorTests/BolusCalculatorTests.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ import Testing
8484
// correctionInsulin = targetDifferenceInsulin = 2U
8585
// iobInsulinReduction = 1U
8686
// superBolusInsulin = 0U (disabled)
87-
// no adjustment for fatty meals (disabled)
87+
// no adjustment for reduced bolus (disabled)
8888
// wholeCalc = round(wholeCobInsulin + correctionInsulin + fifteenMinutesInsulin - iobInsulinReduction, 3) = 11.125U
8989
// insulinCalculated = round(wholeCalc × fraction, 3) = 8.9U
9090

@@ -135,7 +135,7 @@ import Testing
135135
#expect(result.wholeCobInsulin == wholeCobInsulin, "Insulin for total carbs should be \(wholeCobInsulin)U")
136136
}
137137

138-
@Test("Calculate insulin for fatty meal") func testFattyMealCalculation() async throws {
138+
@Test("Calculate insulin for reduced bolus") func testFattyMealCalculation() async throws {
139139
// STEP 1: Setup test scenario
140140
// We need to provide a CalculationInput struct
141141
let carbs: Decimal = 80
@@ -180,10 +180,10 @@ import Testing
180180
lastLoopDate: Date()
181181
)
182182

183-
// STEP 3: Calculate insulin with fatty meal enabled
183+
// STEP 3: Calculate insulin with reduced bolus enabled
184184
let fattyMealResult = await calculator.calculateInsulin(input: input)
185185

186-
// STEP 4: Calculate insulin with fatty meal disabled for comparison
186+
// STEP 4: Calculate insulin with reduced bolus disabled for comparison
187187
let standardInput = CalculationInput(
188188
carbs: carbs,
189189
currentBG: currentBG,
@@ -208,7 +208,7 @@ import Testing
208208
let standardResult = await calculator.calculateInsulin(input: standardInput)
209209

210210
// STEP 5: Verify results
211-
// Fatty meal should reduce the insulin amount by the fatty meal factor (0.8)
211+
// Reduced bolus should reduce the insulin amount by the reduced bolus factor (0.8)
212212
let expectedReduction = fattyMealFactor
213213
let actualReduction = Decimal(
214214
(Double(fattyMealResult.insulinCalculated) / Double(standardResult.insulinCalculated) * 10.0).rounded() / 10.0
@@ -217,11 +217,11 @@ import Testing
217217
#expect(
218218
actualReduction == expectedReduction,
219219
"""
220-
Fatty meal calculation incorrect
220+
Reduced bolus calculation incorrect
221221
Expected reduction factor: \(expectedReduction)
222222
Actual reduction factor: \(actualReduction)
223223
Standard calculation: \(standardResult.insulinCalculated)U
224-
Fatty meal calculation: \(fattyMealResult.insulinCalculated)U
224+
Reduced bolus calculation: \(fattyMealResult.insulinCalculated)U
225225
"""
226226
)
227227
}
@@ -522,7 +522,7 @@ import Testing
522522
// Then
523523
#expect(units == expectedUnits, "Units should match settings")
524524
#expect(fraction == expectedFraction, "Override factor should match settings")
525-
#expect(fattyMealFactor == expectedFattyMealFactor, "Fatty meal factor should match settings")
525+
#expect(fattyMealFactor == expectedFattyMealFactor, "Reduced bolus factor should match settings")
526526
#expect(sweetMealFactor == expectedSweetMealFactor, "Sweet meal factor should match settings")
527527
#expect(maxCarbs == expectedMaxCarbs, "Max carbs should match settings")
528528

0 commit comments

Comments
 (0)