|
|
@@ -743,7 +743,6 @@ final class BaseAPSManager: APSManager, Injectable {
|
|
|
guard !array.isEmpty else {
|
|
|
return 0
|
|
|
}
|
|
|
- let units = settingsManager.settings.units
|
|
|
let sorted = array.sorted()
|
|
|
let length = array.count
|
|
|
|
|
|
@@ -1170,6 +1169,15 @@ final class BaseAPSManager: APSManager, Injectable {
|
|
|
|
|
|
let avg = Averages(Average: [avgs], Median: [median])
|
|
|
|
|
|
+ let suggestion = storage.retrieve(OpenAPS.Enact.suggested, as: Suggestion.self)
|
|
|
+
|
|
|
+ let insulin = Ins(
|
|
|
+ TDD: roundDecimal(currentTDD, 2),
|
|
|
+ bolus: suggestion?.insulin?.bolus ?? 0,
|
|
|
+ temp_basal: suggestion?.insulin?.temp_basal ?? 0,
|
|
|
+ scheduled_basal: suggestion?.insulin?.scheduled_basal ?? 0
|
|
|
+ )
|
|
|
+
|
|
|
let dailystat = Statistics(
|
|
|
createdAt: Date(),
|
|
|
iPhone: UIDevice.current.getDeviceId,
|
|
|
@@ -1184,11 +1192,15 @@ final class BaseAPSManager: APSManager, Injectable {
|
|
|
CGM: cgm.rawValue,
|
|
|
insulinType: insulin_type.rawValue,
|
|
|
peakActivityTime: iPa,
|
|
|
- TDD: roundDecimal(currentTDD, 2),
|
|
|
Carbs_24h: carbTotal,
|
|
|
GlucoseStorage_Days: Decimal(daysBG),
|
|
|
- Statistics: Stats(Distribution: [TimeInRange], Glucose: [avg], HbA1c: [hbs], LoopCycles: [loopstat])
|
|
|
- // LoopStats: [loopstat]
|
|
|
+ Statistics: Stats(
|
|
|
+ Distribution: [TimeInRange],
|
|
|
+ Glucose: [avg],
|
|
|
+ HbA1c: [hbs],
|
|
|
+ LoopCycles: [loopstat],
|
|
|
+ Insulin: [insulin]
|
|
|
+ )
|
|
|
)
|
|
|
|
|
|
storage.transaction { storage in
|