Skip to content

Commit

Permalink
part 5
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon-b-m committed Mar 28, 2023
1 parent 6ed202d commit daa231f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,6 @@ extension AddTempTarget {
var lowTarget = low

if viewPercantage {
/*
var ratio = Decimal(percentage / 100)
let hB = Decimal(hbt)
let c = hB - 100
var target = (c / ratio) - c + 100

if c * (c + target - 100) <= 0 {
ratio = maxValue
target = (c / ratio) - c + 100
}
lowTarget = target
lowTarget = Decimal(round(Double(target)))
*/
lowTarget = computeTarget()
saveSettings = true
}
Expand Down Expand Up @@ -94,20 +81,6 @@ extension AddTempTarget {
var lowTarget = low

if viewPercantage {
/*
var ratio = Decimal(percentage / 100)
let hB = Decimal(hbt)
let c = hB - 100
var target = (c / ratio) - c + 100

if c * (c + target - 100) <= 0 {
ratio = maxValue
target = (c / ratio) - c + 100
}
lowTarget = target
lowTarget = Decimal(round(Double(target)))
*/

lowTarget = computeTarget()
saveSettings = true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ extension AddTempTarget {
}

HStack {
Text("Advanced settings")
Text("Advanced")
Toggle(isOn: $state.viewPercantage) {}.controlSize(.mini)
Image(systemName: "figure.highintensity.intervaltraining")
Image(systemName: "fork.knife")
Expand Down Expand Up @@ -68,7 +68,7 @@ extension AddTempTarget {
": \(state.computeTarget().asMmolL.formatted(.number.grouping(.never).rounded().precision(.fractionLength(1)))) mmol/L" :
": \(state.computeTarget().formatted(.number.grouping(.never).rounded().precision(.fractionLength(0)))) mg/dl"
)
) // .foregroundColor(.primary).italic()
)

Slider(
value: $state.hbt,
Expand Down Expand Up @@ -164,20 +164,6 @@ extension AddTempTarget {
}
}

/*
func computeTarget() -> Decimal {
var ratio = Decimal(state.percentage / 100)
let c = Decimal(state.hbt - 100)
var target = (c / ratio) - c + 100

if c * (c + target - 100) <= 0 {
ratio = state.maxValue
target = (c / ratio) - c + 100
}
return target
}
*/

private func presetView(for preset: TempTarget) -> some View {
var low = preset.targetBottom
var high = preset.targetTop
Expand Down

0 comments on commit daa231f

Please sign in to comment.