Browse Source

Merge branch 'dev' into feat/o5

Deniz Cengiz 1 day ago
parent
commit
7395aea3ce

+ 1 - 1
Config.xcconfig

@@ -19,7 +19,7 @@ TRIO_APP_GROUP_ID = group.org.nightscout.$(DEVELOPMENT_TEAM).trio.trio-app-group
 
 // The developers set the version numbers, please leave them alone
 APP_VERSION = 0.8.4
-APP_DEV_VERSION = 0.8.4.7
+APP_DEV_VERSION = 0.8.4.8
 APP_BUILD_NUMBER = 1
 COPYRIGHT_NOTICE =
 

+ 1 - 1
Trio/Sources/APS/OpenAPSSwift/Profile/Carbs.swift

@@ -19,7 +19,7 @@ struct Carbs {
         }
 
         // Check for invalid values
-        if currentRatio < 3 || currentRatio > 150 {
+        if currentRatio < 1 || currentRatio > 150 {
             warning(.openAPS, "Warning: carbRatio of \(currentRatio) out of bounds.")
             return nil
         }

+ 13 - 1
TrioTests/OpenAPSSwiftTests/ProfileCarbsTests.swift

@@ -35,11 +35,23 @@ import Testing
         #expect(ratio == 1) // 12 grams per exchange
     }
 
+    @Test("should allow ratios of 1") func allowLowRatios() async throws {
+        let schedule = CarbRatios(
+            units: .grams,
+            schedule: [
+                CarbRatioEntry(start: "00:00:00", offset: 0, ratio: 1)
+            ]
+        )
+        let now = Calendar.current.date(from: DateComponents(year: 2025, month: 1, day: 26, hour: 2))!
+        let ratio = Carbs.carbRatioLookup(carbRatio: schedule, now: now)
+        #expect(ratio == 1)
+    }
+
     @Test("should reject invalid ratios") func rejectInvalidRatios() async throws {
         let invalidSchedule = CarbRatios(
             units: .grams,
             schedule: [
-                CarbRatioEntry(start: "00:00:00", offset: 0, ratio: 2),
+                CarbRatioEntry(start: "00:00:00", offset: 0, ratio: 0.5),
                 CarbRatioEntry(start: "03:00:00", offset: 180, ratio: 15)
             ]
         )