From 6817f1917ba7bff2c13773689de4a3cc2ab4a833 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Bj=C3=B6rkert?= Date: Sat, 18 Jul 2026 16:30:39 +0200 Subject: [PATCH 1/2] Fix TDD and Updated dropping out on Trio SMB follow-up uploads --- .../Controllers/Nightscout/DeviceStatusOpenAPS.swift | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/LoopFollow/Controllers/Nightscout/DeviceStatusOpenAPS.swift b/LoopFollow/Controllers/Nightscout/DeviceStatusOpenAPS.swift index 25031e413..96d7c74ff 100644 --- a/LoopFollow/Controllers/Nightscout/DeviceStatusOpenAPS.swift +++ b/LoopFollow/Controllers/Nightscout/DeviceStatusOpenAPS.swift @@ -20,7 +20,9 @@ extension MainViewController { var updatedTime: TimeInterval? - if let timestamp = enactedOrSuggested["timestamp"] as? String, + // Prefer deliverAt: Trio copies it into timestamp when both exist, but + // some uploads (Trio SMB follow-ups, oref0 rigs) only carry deliverAt. + if let timestamp = enactedOrSuggested["deliverAt"] as? String ?? enactedOrSuggested["timestamp"] as? String, let parsedTime = formatter.date(from: timestamp)?.timeIntervalSince1970 { updatedTime = parsedTime @@ -162,7 +164,11 @@ extension MainViewController { } // TDD - if let tddMetric = InsulinMetric(from: enactedOrSuggested, key: "TDD") { + // Trio's SMB follow-up uploads re-send a suggested object without TDD; + // the enacted object in the same record still has it. + if let tddMetric = InsulinMetric(from: enactedOrSuggested, key: "TDD") + ?? InsulinMetric(from: lastLoopRecord["enacted"], key: "TDD") + { infoManager.updateInfoData(type: .tdd, value: tddMetric) Storage.shared.lastTdd.value = tddMetric.value } From 421fdc4865274904ac57997a5c9f24d74c8fc2a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Bj=C3=B6rkert?= Date: Sat, 18 Jul 2026 16:39:56 +0200 Subject: [PATCH 2/2] Remove comments --- LoopFollow/Controllers/Nightscout/DeviceStatusOpenAPS.swift | 4 ---- 1 file changed, 4 deletions(-) diff --git a/LoopFollow/Controllers/Nightscout/DeviceStatusOpenAPS.swift b/LoopFollow/Controllers/Nightscout/DeviceStatusOpenAPS.swift index 96d7c74ff..d3f5fcc43 100644 --- a/LoopFollow/Controllers/Nightscout/DeviceStatusOpenAPS.swift +++ b/LoopFollow/Controllers/Nightscout/DeviceStatusOpenAPS.swift @@ -20,8 +20,6 @@ extension MainViewController { var updatedTime: TimeInterval? - // Prefer deliverAt: Trio copies it into timestamp when both exist, but - // some uploads (Trio SMB follow-ups, oref0 rigs) only carry deliverAt. if let timestamp = enactedOrSuggested["deliverAt"] as? String ?? enactedOrSuggested["timestamp"] as? String, let parsedTime = formatter.date(from: timestamp)?.timeIntervalSince1970 { @@ -164,8 +162,6 @@ extension MainViewController { } // TDD - // Trio's SMB follow-up uploads re-send a suggested object without TDD; - // the enacted object in the same record still has it. if let tddMetric = InsulinMetric(from: enactedOrSuggested, key: "TDD") ?? InsulinMetric(from: lastLoopRecord["enacted"], key: "TDD") {