|
|
@@ -74,8 +74,10 @@ struct BolusInputView: View {
|
|
|
Spacer()
|
|
|
|
|
|
// Display the current carb amount
|
|
|
- // TODO: format this properly using state.bolusIncrement
|
|
|
- Text(String(format: "%.2f U", bolusAmount * Double(truncating: state.bolusIncrement as NSNumber)))
|
|
|
+ let bolusIncrement = Double(truncating: state.bolusIncrement as NSNumber)
|
|
|
+ let adjustedBolusAmount = floor(bolusAmount / bolusIncrement) * bolusIncrement
|
|
|
+
|
|
|
+ Text(String(format: "%.2f U", adjustedBolusAmount))
|
|
|
.fontWeight(.bold)
|
|
|
.font(.system(.title2, design: .rounded))
|
|
|
.foregroundColor(bolusAmount > 0.0 && bolusAmount >= effectiveBolusLimit ? .loopRed : .primary)
|