Skip to content

Commit

Permalink
fix logging and skip 2hr Chart
Browse files Browse the repository at this point in the history
  • Loading branch information
mountrcg committed May 18, 2024
1 parent 5c9d05a commit 785e2af
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 11 deletions.
4 changes: 2 additions & 2 deletions FreeAPS/Sources/Modules/Home/HomeStateModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -354,8 +354,8 @@ extension Home {
let totalBoluses = bolusesForCurrentDay.map { $0.amount ?? 0 }.reduce(0, +)
/// final TINS value, i.e. boluses AND delivered basal
let total = totalBoluses + basalInsulinForCurrentDay
debug(.default, "totalBoluses: \(totalBoluses)")
debug(.default, "basalInsulinForCurrentDay: \(basalInsulinForCurrentDay)")
debug(.default, "TINS Bolus \(startTime): \(numberFormatter.string(from: totalBoluses as NSNumber) ?? "NaN")")
debug(.default, "TINS Basal: \(numberFormatter.string(from: basalInsulinForCurrentDay as NSNumber) ?? "NaN")")

calculatedTins = numberFormatter.string(from: total as NSNumber) ?? "NaN"

Expand Down
28 changes: 19 additions & 9 deletions FreeAPS/Sources/Modules/Home/View/HomeRootView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ extension Home {
}

@State var timeButtons: [Buttons] = [
Buttons(label: "2h", number: "2", active: false, hours: 2),
Buttons(label: "4h", number: "4", active: false, hours: 4),
Buttons(label: "3h", number: "3", active: false, hours: 3),
Buttons(label: "6h", number: "6", active: false, hours: 6),
Buttons(label: "12h", number: "12", active: false, hours: 12),
Buttons(label: "24h", number: "24", active: false, hours: 24)
Buttons(label: "24h", number: "24", active: false, hours: 24),
Buttons(label: "36h", number: "36", active: false, hours: 36)
]

let buttonFont = Font.custom("TimeButtonFont", size: 14)
Expand Down Expand Up @@ -315,12 +315,22 @@ extension Home {
.padding(.leading, 8)
}
if state.tins {
Text(
"TINS: \(state.calculateTINS())" +
NSLocalizedString(" U", comment: "Unit in number of units delivered (keep the space character!)")
)
.font(.system(size: 12, weight: .bold))
.foregroundColor(.insulin)
HStack {
Text(
"TINS: \(state.calculatedTins)" +
NSLocalizedString(" U", comment: "Unit in number of units delivered (keep the space character!)")
)
.font(.system(size: 12, weight: .bold))
.foregroundColor(.insulin)
.onChange(of: state.hours) { _ in
state.calculatedTins = state.calculateTINS()
}
.onAppear {
DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
state.calculatedTins = state.calculateTINS()
}
}
}
}

if let tempTargetString = tempTargetString {
Expand Down

0 comments on commit 785e2af

Please sign in to comment.