|
@@ -748,7 +748,7 @@ extension JSONImporter {
|
|
|
|
|
|
|
|
func importGlucoseHistoryIfNeeded() async throws {
|
|
func importGlucoseHistoryIfNeeded() async throws {
|
|
|
debug(.coreData, "Checking for glucose history JSON file...")
|
|
debug(.coreData, "Checking for glucose history JSON file...")
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
let url = openAPSFileURL(OpenAPS.Monitor.glucose)
|
|
let url = openAPSFileURL(OpenAPS.Monitor.glucose)
|
|
|
let suffix = "migrated.json"
|
|
let suffix = "migrated.json"
|
|
|
|
|
|
|
@@ -756,24 +756,24 @@ extension JSONImporter {
|
|
|
debug(.coreData, "❌ No JSON file to import at \(url.path)")
|
|
debug(.coreData, "❌ No JSON file to import at \(url.path)")
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
debug(.coreData, "Glucose history JSON file found, proceeding with import of glucose history...")
|
|
debug(.coreData, "Glucose history JSON file found, proceeding with import of glucose history...")
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
try await importGlucoseHistory(url: url, now: Date())
|
|
try await importGlucoseHistory(url: url, now: Date())
|
|
|
|
|
|
|
|
debug(.coreData, "Glucose history JSON file imported successfully, moving to \(suffix)")
|
|
debug(.coreData, "Glucose history JSON file imported successfully, moving to \(suffix)")
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
try FileManager.default.moveItem(
|
|
try FileManager.default.moveItem(
|
|
|
at: url,
|
|
at: url,
|
|
|
to: url.deletingPathExtension().appendingPathExtension(suffix)
|
|
to: url.deletingPathExtension().appendingPathExtension(suffix)
|
|
|
)
|
|
)
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
debug(.coreData, "Import of glucose history completed successfully.")
|
|
debug(.coreData, "Import of glucose history completed successfully.")
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func importPumpHistoryIfNeeded() async throws {
|
|
func importPumpHistoryIfNeeded() async throws {
|
|
|
debug(.coreData, "Checking for pump history JSON file...")
|
|
debug(.coreData, "Checking for pump history JSON file...")
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
let url = openAPSFileURL(OpenAPS.Monitor.pumpHistory)
|
|
let url = openAPSFileURL(OpenAPS.Monitor.pumpHistory)
|
|
|
let suffix = "migrated.json"
|
|
let suffix = "migrated.json"
|
|
|
|
|
|
|
@@ -781,24 +781,24 @@ extension JSONImporter {
|
|
|
debug(.coreData, "❌ No JSON file to import at \(url.path)")
|
|
debug(.coreData, "❌ No JSON file to import at \(url.path)")
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
debug(.coreData, "Pump history JSON file found, proceeding with import of glucose history...")
|
|
debug(.coreData, "Pump history JSON file found, proceeding with import of glucose history...")
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
try await importPumpHistory(url: url, now: Date())
|
|
try await importPumpHistory(url: url, now: Date())
|
|
|
|
|
|
|
|
debug(.coreData, "Pump history JSON file imported successfully, moving to \(suffix)")
|
|
debug(.coreData, "Pump history JSON file imported successfully, moving to \(suffix)")
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
try FileManager.default.moveItem(
|
|
try FileManager.default.moveItem(
|
|
|
at: url,
|
|
at: url,
|
|
|
to: url.deletingPathExtension().appendingPathExtension(suffix)
|
|
to: url.deletingPathExtension().appendingPathExtension(suffix)
|
|
|
)
|
|
)
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
debug(.coreData, "Import of pump history completed successfully.")
|
|
debug(.coreData, "Import of pump history completed successfully.")
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func importCarbHistoryIfNeeded() async throws {
|
|
func importCarbHistoryIfNeeded() async throws {
|
|
|
debug(.coreData, "Checking for carb history JSON file...")
|
|
debug(.coreData, "Checking for carb history JSON file...")
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
let url = openAPSFileURL(OpenAPS.Monitor.pumpHistory)
|
|
let url = openAPSFileURL(OpenAPS.Monitor.pumpHistory)
|
|
|
let suffix = "migrated.json"
|
|
let suffix = "migrated.json"
|
|
|
|
|
|
|
@@ -806,24 +806,24 @@ extension JSONImporter {
|
|
|
debug(.coreData, "❌ No JSON file to import at \(url.path)")
|
|
debug(.coreData, "❌ No JSON file to import at \(url.path)")
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
debug(.coreData, "Carb history JSON file found, proceeding with import of glucose history...")
|
|
debug(.coreData, "Carb history JSON file found, proceeding with import of glucose history...")
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
try await importCarbHistory(url: url, now: Date())
|
|
try await importCarbHistory(url: url, now: Date())
|
|
|
|
|
|
|
|
debug(.coreData, "Carb history JSON file imported successfully, moving to \(suffix)")
|
|
debug(.coreData, "Carb history JSON file imported successfully, moving to \(suffix)")
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
try FileManager.default.moveItem(
|
|
try FileManager.default.moveItem(
|
|
|
at: url,
|
|
at: url,
|
|
|
to: url.deletingPathExtension().appendingPathExtension(suffix)
|
|
to: url.deletingPathExtension().appendingPathExtension(suffix)
|
|
|
)
|
|
)
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
debug(.coreData, "Import of carb history completed successfully.")
|
|
debug(.coreData, "Import of carb history completed successfully.")
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func importDeterminationIfNeeded() async throws {
|
|
func importDeterminationIfNeeded() async throws {
|
|
|
debug(.coreData, "Checking for determination JSON files...")
|
|
debug(.coreData, "Checking for determination JSON files...")
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
let enactedPath = OpenAPS.Enact.enacted // "enact/enacted.json"
|
|
let enactedPath = OpenAPS.Enact.enacted // "enact/enacted.json"
|
|
|
let suggestedPath = OpenAPS.Enact.suggested // "enact/suggested.json"
|
|
let suggestedPath = OpenAPS.Enact.suggested // "enact/suggested.json"
|
|
|
let suffix = "migrated.json"
|
|
let suffix = "migrated.json"
|
|
@@ -837,11 +837,11 @@ extension JSONImporter {
|
|
|
debug(.coreData, "❌ No JSON file to import at \(enactedURL.path) and/or \(suggestedURL.path)")
|
|
debug(.coreData, "❌ No JSON file to import at \(enactedURL.path) and/or \(suggestedURL.path)")
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
debug(.coreData, "Determination JSON files found, proceeding with import...")
|
|
debug(.coreData, "Determination JSON files found, proceeding with import...")
|
|
|
|
|
|
|
|
try await importOrefDetermination(enactedUrl: enactedURL, suggestedUrl: suggestedURL, now: Date())
|
|
try await importOrefDetermination(enactedUrl: enactedURL, suggestedUrl: suggestedURL, now: Date())
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
debug(.coreData, "Determination JSON file(s) imported successfully, moving to \(suffix)")
|
|
debug(.coreData, "Determination JSON file(s) imported successfully, moving to \(suffix)")
|
|
|
|
|
|
|
|
try FileManager.default.moveItem(at: enactedURL, to: enactedURL.deletingPathExtension().appendingPathExtension(suffix))
|
|
try FileManager.default.moveItem(at: enactedURL, to: enactedURL.deletingPathExtension().appendingPathExtension(suffix))
|
|
@@ -849,7 +849,7 @@ extension JSONImporter {
|
|
|
at: suggestedURL,
|
|
at: suggestedURL,
|
|
|
to: suggestedURL.deletingPathExtension().appendingPathExtension(suffix)
|
|
to: suggestedURL.deletingPathExtension().appendingPathExtension(suffix)
|
|
|
)
|
|
)
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
debug(.coreData, "Import of determination data completed successfully.")
|
|
debug(.coreData, "Import of determination data completed successfully.")
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|