Explorar o código

Ensure correct context is used to fetch active bolus

Deniz Cengiz hai 1 ano
pai
achega
fc5e0ecdcb
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      Trio/Sources/Services/WatchManager/AppleWatchManager.swift

+ 1 - 1
Trio/Sources/Services/WatchManager/AppleWatchManager.swift

@@ -337,7 +337,7 @@ final class BaseWatchManager: NSObject, WCSessionDelegate, Injectable, WatchMana
     @MainActor func getActiveBolusAmount() async {
         if let lastBolusObjectId = await fetchLastBolus() {
             let lastBolusObject: [PumpEventStored] = await CoreDataStack.shared
-                .getNSManagedObject(with: [lastBolusObjectId], context: backgroundContext)
+                .getNSManagedObject(with: [lastBolusObjectId], context: viewContext)
 
             activeBolusAmount = lastBolusObject.first?.bolus?.amount?.doubleValue ?? 0.0
         }