polscm32 2 лет назад
Родитель
Сommit
00198176ee

+ 1 - 0
FreeAPS/Sources/Modules/Bolus/BolusStateModel.swift

@@ -426,6 +426,7 @@ extension Bolus {
             // save to core data asynchronously
             context.perform {
                 let newItem = InsulinStored(context: self.context)
+                newItem.id = UUID()
                 newItem.amount = self.amount as NSDecimalNumber
                 newItem.date = Date()
                 newItem.external = true

+ 3 - 3
FreeAPS/Sources/Modules/Home/View/Chart/MainChartView.swift

@@ -161,7 +161,7 @@ struct MainChartView: View {
         VStack {
             ScrollViewReader { scroller in
                 ScrollView(.horizontal, showsIndicators: false) {
-                    VStack(spacing: 0) {
+                    LazyVStack(spacing: 0) {
                         mainChart
                         basalChart
 
@@ -273,7 +273,7 @@ extension MainChartView {
             ) { _ in
                 calculatePredictions()
             }
-            .frame(minHeight: UIScreen.main.bounds.height * 0.2)
+            .frame(minHeight: UIScreen.main.bounds.height * 0.3)
             .frame(width: fullWidth(viewWidth: screenSize.width))
             .chartXScale(domain: startMarker ... endMarker)
             .chartXAxis { mainChartXAxis }
@@ -335,7 +335,7 @@ extension MainChartView {
             }.onChange(of: basalProfile) { _ in
                 calculateTempBasals()
             }
-            .frame(height: UIScreen.main.bounds.height * 0.08)
+            .frame(maxHeight: UIScreen.main.bounds.height * 0.05)
             .frame(width: fullWidth(viewWidth: screenSize.width))
             .chartXScale(domain: startMarker ... endMarker)
             .chartXAxis { basalChartXAxis }

+ 2 - 1
Model/Helper/InsulinStored+helper.swift

@@ -5,7 +5,8 @@ extension InsulinStored {
     static func fetch(_ predicate: NSPredicate = .predicateForOneDayAgo) -> NSFetchRequest<InsulinStored> {
         let request = InsulinStored.fetchRequest()
         request.sortDescriptors = [NSSortDescriptor(keyPath: \InsulinStored.date, ascending: true)]
-        request.fetchLimit = 100
+        request.propertiesToFetch = ["amount", "date"]
+        request.resultType = .managedObjectResultType
         request.predicate = predicate
         return request
     }