|
@@ -182,13 +182,7 @@ struct MainChartView: View {
|
|
|
ScrollViewReader { scroll in
|
|
ScrollViewReader { scroll in
|
|
|
ZStack(alignment: .top) {
|
|
ZStack(alignment: .top) {
|
|
|
tempTargetsView(fullSize: fullSize).drawingGroup()
|
|
tempTargetsView(fullSize: fullSize).drawingGroup()
|
|
|
-
|
|
|
|
|
- ZStack {
|
|
|
|
|
- basalView(fullSize: fullSize).drawingGroup()
|
|
|
|
|
- Text(calculateTINS())
|
|
|
|
|
- .font(.callout).fontWeight(.bold)
|
|
|
|
|
- .offset(x: 0, y: 0)
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ basalView(fullSize: fullSize).drawingGroup()
|
|
|
|
|
|
|
|
mainView(fullSize: fullSize).id(Config.endID)
|
|
mainView(fullSize: fullSize).id(Config.endID)
|
|
|
.drawingGroup()
|
|
.drawingGroup()
|
|
@@ -1218,29 +1212,4 @@ extension MainChartView {
|
|
|
let oneSecondWidth = oneSecondStep(viewWidth: viewWidth)
|
|
let oneSecondWidth = oneSecondStep(viewWidth: viewWidth)
|
|
|
return oneSecondWidth * CGFloat(lastDeltaTime)
|
|
return oneSecondWidth * CGFloat(lastDeltaTime)
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- // MARK: WORKS....BUT MAYBE TIMEZONE PROBLEMS COULD OCCUR
|
|
|
|
|
-
|
|
|
|
|
- // DEFINETELY SOMETHING FOR OUR TIMEZONE EXPERT.....
|
|
|
|
|
-
|
|
|
|
|
- private func calculateTINS() -> String {
|
|
|
|
|
- let date = Date()
|
|
|
|
|
- let calendar = Calendar.current
|
|
|
|
|
- let offset = screenHours
|
|
|
|
|
-
|
|
|
|
|
- var offsetComponents = DateComponents()
|
|
|
|
|
- // offsetComponents.hour = -offset.rawValue
|
|
|
|
|
- offsetComponents.hour = -Int(offset)
|
|
|
|
|
-
|
|
|
|
|
- let startTime = calendar.date(byAdding: offsetComponents, to: date)!
|
|
|
|
|
- print("******************")
|
|
|
|
|
- print("die voll krasse start time ist: \(startTime)")
|
|
|
|
|
-
|
|
|
|
|
- let bolusesForCurrentDay = boluses.filter { $0.timestamp >= startTime && $0.type == .bolus }
|
|
|
|
|
-
|
|
|
|
|
- let totalBolus = bolusesForCurrentDay.map { $0.amount ?? 0 }.reduce(0, +)
|
|
|
|
|
- let roundedTotalBolus = Decimal(round(100 * Double(totalBolus)) / 100)
|
|
|
|
|
-
|
|
|
|
|
- return "\(roundedTotalBolus) U"
|
|
|
|
|
- }
|
|
|
|
|
}
|
|
}
|