ソースを参照

fixes ...still wip

polscm32 2 年 前
コミット
387bdb84aa

+ 1 - 1
FreeAPS.xcworkspace/xcshareddata/swiftpm/Package.resolved

@@ -39,7 +39,7 @@
       },
       {
         "package": "SwiftCharts",
-        "repositoryURL": "https://github.com/ivanschuetz/SwiftCharts.git",
+        "repositoryURL": "https://github.com/ivanschuetz/SwiftCharts",
         "state": {
           "branch": "master",
           "revision": "c354c1945bb35a1f01b665b22474f6db28cba4a2",

+ 6 - 2
FreeAPS/Sources/APS/OpenAPS/OpenAPS.swift

@@ -125,7 +125,7 @@ final class OpenAPS {
             debugPrint("OpenAPS: \(#function) \(DebuggingIdentifiers.succeeded) fetched pump history")
 
             return try context
-                .fetch(PumpEventStored.fetch(NSPredicate.pumpHistoryLast24h, ascending: true))
+                .fetch(PumpEventStored.fetch(NSPredicate.pumpHistoryLast24h, ascending: false))
         } catch {
             debugPrint(
                 "OpenAPS: \(#function) \(DebuggingIdentifiers.failed) error while fetching pumphistory for determine basal with error: \(error)"
@@ -145,9 +145,13 @@ final class OpenAPS {
                 let tempBasal = currentTemp.rawJSON
                 self.storage.save(tempBasal, as: Monitor.tempBasal)
 
-//                let pumpHistory = self.loadFileFromStorage(name: OpenAPS.Monitor.pumpHistory)
+                let a = self.loadFileFromStorage(name: OpenAPS.Monitor.pumpHistory)
                 let pumpHistory = self.fetchPumpHistory()
                 let pumpHistoryJSON = self.jsonConverter.convertToJSON(pumpHistory)
+//                print("pump history \(DebuggingIdentifiers.inProgress) \(String(describing: pumpHistory))")
+
+                print("pump historyjson \(DebuggingIdentifiers.inProgress) \(pumpHistoryJSON)")
+                print("vorlage \(DebuggingIdentifiers.inProgress) \(a)")
 
                 // carbs
                 let carbs = self.fetchCarbs()

+ 4 - 3
Model/Helper/PumpEvent+helper.swift

@@ -70,7 +70,7 @@ extension PumpEventStored: Encodable {
         // temp basal CD entity
         case duration
         case rate
-        case tempType
+        case temp
     }
 
     public func encode(to encoder: Encoder) throws {
@@ -121,10 +121,11 @@ extension PumpEventStored: Encodable {
             try container.encode(0, forKey: .rate)
         }
         // temp type
+        // its called "temp" in the json thats passed into determineBasal hence the undescriptive name of this coding key
         if let tempType = tempBasal?.tempType {
-            try container.encode(tempType, forKey: .tempType)
+            try container.encode(tempType, forKey: .temp)
         } else {
-            try container.encode("absolute", forKey: .tempType)
+            try container.encode("absolute", forKey: .temp)
         }
     }
 }