Procházet zdrojové kódy

Add mmol/L handling for sector popover

Deniz Cengiz před 1 rokem
rodič
revize
55a5be8b7e

+ 17 - 9
Trio/Sources/Localizations/Main/Localizable.xcstrings

@@ -6663,6 +6663,16 @@
         }
       }
     },
+    "%@-%@" : {
+      "localizations" : {
+        "en" : {
+          "stringUnit" : {
+            "state" : "new",
+            "value" : "%1$@-%2$@"
+          }
+        }
+      }
+    },
     "%@: %@" : {
       "localizations" : {
         "ar" : {
@@ -12972,6 +12982,9 @@
         }
       }
     },
+    "< %@" : {
+
+    },
     "< 3.3" : {
       "extractionState" : "stale",
       "localizations" : {
@@ -13079,9 +13092,6 @@
         }
       }
     },
-    "< 54" : {
-
-    },
     "< 59" : {
       "extractionState" : "stale",
       "localizations" : {
@@ -13403,6 +13413,9 @@
         }
       }
     },
+    "> %@" : {
+
+    },
     "> 11.0" : {
       "extractionState" : "stale",
       "localizations" : {
@@ -13510,9 +13523,6 @@
         }
       }
     },
-    "> 180" : {
-
-    },
     "> 198" : {
       "extractionState" : "stale",
       "localizations" : {
@@ -16339,6 +16349,7 @@
       }
     },
     "70-140" : {
+      "extractionState" : "stale",
       "localizations" : {
         "ar" : {
           "stringUnit" : {
@@ -16444,9 +16455,6 @@
         }
       }
     },
-    "70-180" : {
-
-    },
     "75%:" : {
 
     },

+ 14 - 6
Trio/Sources/Modules/Stat/View/ViewElements/SectorChart.swift

@@ -48,13 +48,13 @@ struct SectorChart: View {
 
             VStack(alignment: .leading, spacing: 10) {
                 VStack(alignment: .leading, spacing: 5) {
-                    Text("70-180").font(.subheadline).foregroundStyle(Color.secondary)
+                    Text("\(formatValue(lowLimit))-\(formatValue(highLimit))").font(.subheadline).foregroundStyle(Color.secondary)
                     Text(inRangePercentage.formatted(.number.grouping(.never).rounded().precision(.fractionLength(0))) + "%")
                         .foregroundStyle(Color.loopGreen)
                 }
 
                 VStack(alignment: .leading, spacing: 5) {
-                    Text("70-140").font(.subheadline).foregroundStyle(Color.secondary)
+                    Text("\(formatValue(lowLimit))-\(formatValue(140))").font(.subheadline).foregroundStyle(Color.secondary)
                     Text(tightPercentage.formatted(.number.grouping(.never).rounded().precision(.fractionLength(0))) + "%")
                         .foregroundStyle(Color.green)
                 }
@@ -62,13 +62,13 @@ struct SectorChart: View {
 
             VStack(alignment: .leading, spacing: 10) {
                 VStack(alignment: .leading, spacing: 5) {
-                    Text("> 180").font(.subheadline).foregroundStyle(Color.secondary)
+                    Text("> \(formatValue(highLimit))").font(.subheadline).foregroundStyle(Color.secondary)
                     Text(highPercentage.formatted(.number.grouping(.never).rounded().precision(.fractionLength(0))) + "%")
                         .foregroundStyle(Color.orange)
                 }
 
                 VStack(alignment: .leading, spacing: 5) {
-                    Text("< 54").font(.subheadline).foregroundStyle(Color.secondary)
+                    Text("< \(formatValue(lowLimit))").font(.subheadline).foregroundStyle(Color.secondary)
                     Text(lowPercentage.formatted(.number.grouping(.never).rounded().precision(.fractionLength(0))) + "%")
                         .foregroundStyle(Color.loopRed)
                 }
@@ -77,12 +77,20 @@ struct SectorChart: View {
             VStack(alignment: .leading, spacing: 10) {
                 VStack(alignment: .leading, spacing: 5) {
                     Text("Average").font(.subheadline).foregroundStyle(Color.secondary)
-                    Text(glucoseAverage.formatted(.number.grouping(.never).rounded().precision(.fractionLength(0))))
+                    Text(
+                        units == .mgdL ? glucoseAverage
+                            .formatted(.number.grouping(.never).rounded().precision(.fractionLength(0))) : glucoseAverage.asMmolL
+                            .formatted(.number.grouping(.never).rounded().precision(.fractionLength(1)))
+                    )
                 }
 
                 VStack(alignment: .leading, spacing: 5) {
                     Text("Median").font(.subheadline).foregroundStyle(Color.secondary)
-                    Text(medianGlucose.formatted(.number.grouping(.never).rounded().precision(.fractionLength(0))))
+                    Text(
+                        units == .mgdL ? medianGlucose
+                            .formatted(.number.grouping(.never).rounded().precision(.fractionLength(0))) : medianGlucose.asMmolL
+                            .formatted(.number.grouping(.never).rounded().precision(.fractionLength(1)))
+                    )
                 }
             }