|
|
@@ -101,7 +101,13 @@ struct AddTempTargetForm: View {
|
|
|
toggleScrollWheel: toggleScrollWheel
|
|
|
)
|
|
|
.onChange(of: state.tempTargetTarget) {
|
|
|
- state.percentage = state.computeAdjustedPercentage()
|
|
|
+ // when first setting a custom sensitivity the settings HBT is used and therefore we calculate the sensitivity
|
|
|
+ if state.halfBasalTarget == state.settingHalfBasalTarget {
|
|
|
+ state.percentage = state.computeAdjustedPercentage()
|
|
|
+ } else {
|
|
|
+ // else when changing target value and the already adjusted HBT is used, keep the sensitivity and adjust the HBT instead
|
|
|
+ state.halfBasalTarget = Decimal(state.computeHalfBasalTarget())
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
.listRowBackground(Color.chart)
|