Просмотр исходного кода

Fix mmol/L parsing for limits and maxValue

Deniz Cengiz 1 год назад
Родитель
Сommit
603dec725b
1 измененных файлов с 3 добавлено и 3 удалено
  1. 3 3
      Trio/Sources/Modules/DataTable/View/DataTableRootView.swift

+ 3 - 3
Trio/Sources/Modules/DataTable/View/DataTableRootView.swift

@@ -421,8 +421,8 @@ extension DataTable {
         }
 
         @ViewBuilder private func addGlucoseView() -> some View {
-            let limitLow: Decimal = state.units == .mmolL ? 0.8 : 14
-            let limitHigh: Decimal = state.units == .mmolL ? 40 : 720
+            let limitLow: Decimal = state.units == .mgdL ? Decimal(14) : 14.asMmolL
+            let limitHigh: Decimal = state.units == .mgdL ? Decimal(720) : 720.asMmolL
 
             NavigationView {
                 VStack {
@@ -433,7 +433,7 @@ extension DataTable {
                                 TextFieldWithToolBar(
                                     text: $state.manualGlucose,
                                     placeholder: " ... ",
-                                    maxValue: state.units == .mmolL ? 400 / 18 : 400,
+                                    maxValue: limitHigh,
                                     numberFormatter: manualGlucoseFormatter,
                                     initialFocus: true
                                 )