Quellcode durchsuchen

Making a default daily_stats.json for sorting of objects

Jon Mårtensson vor 3 Jahren
Ursprung
Commit
862b4e966b

+ 19 - 0
FreeAPS/Resources/json/defaults/monitor/daily_stats.json

@@ -0,0 +1,19 @@
+{
+    "date" : "Empty Default JSON",
+    "FAX_Build_Number" : "Default",
+    "FAX_Build_Version" : "Default",
+    "FAX_Build_Date" : "Default",
+    "Algorithm" : "Default",
+    "AdjustmentFactor" : 1,
+    "Pump" : "Default",
+    "CGM" : "Default",
+    "insulinType" : "Default",
+    "peakActivityTime" : 65,
+    "TDD" : 0,
+    "Carbs_24h" : 0,
+    "Hypoglucemias_Percentage" : 0,
+    "TIR_Percentage" : 100,
+    "Hyperglucemias_Percentage" : 0,
+    "BG_daily_Average" : 100,
+    "id" : "Default JSON"
+  }

+ 1 - 1
FreeAPS/Sources/APS/APSManager.swift

@@ -804,7 +804,7 @@ final class BaseAPSManager: APSManager, Injectable {
         let file_3 = loadFileFromStorage(name: OpenAPS.Monitor.dailyStats)
 
         // If empty daily_stats.json, create a first entry
-        if file_3.isEmpty, Calendar.current.component(.hour, from: Date()) == 23,
+        if file_2?[0].Algorithm == "Default", Calendar.current.component(.hour, from: Date()) == 23,
            Calendar.current.component(.minute, from: Date()) > 45
         {
             storage.save(dailystat, as: file)