|
|
@@ -967,6 +967,11 @@ final class BaseAPSManager: APSManager, Injectable {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ }
|
|
|
+
|
|
|
+ if nr_bgs > 0 {
|
|
|
+ // Up to 91 days
|
|
|
+ bg_total = bg / nr_bgs
|
|
|
|
|
|
// If less then 24 hours of glucose data, use total instead
|
|
|
if bg_1 == 0 {
|
|
|
@@ -977,11 +982,6 @@ final class BaseAPSManager: APSManager, Injectable {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if nr_bgs > 0 {
|
|
|
- // Up to 91 days
|
|
|
- bg_total = bg / nr_bgs
|
|
|
- }
|
|
|
-
|
|
|
// Total median
|
|
|
medianBG = medianCalculation(array: bgArray)
|
|
|
var daysBG = 0.0
|
|
|
@@ -1044,7 +1044,7 @@ final class BaseAPSManager: APSManager, Injectable {
|
|
|
// HbA1c estimation (%, mmol/mol) 1 day
|
|
|
var NGSPa1CStatisticValue: Decimal = 0.0
|
|
|
var IFCCa1CStatisticValue: Decimal = 0.0
|
|
|
- if end1 {
|
|
|
+ if end1, bg_1 > 0 {
|
|
|
NGSPa1CStatisticValue = (46.7 + bg_1) / 28.7 // NGSP (%)
|
|
|
IFCCa1CStatisticValue = 10.929 *
|
|
|
(NGSPa1CStatisticValue - 2.152) // IFCC (mmol/mol) A1C(mmol/mol) = 10.929 * (A1C(%) - 2.15)
|