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

add comments for determine basal func back

polscm32 aka Marvout 1 год назад
Родитель
Сommit
34920fff0c
1 измененных файлов с 4 добавлено и 0 удалено
  1. 4 0
      FreeAPS/Sources/APS/OpenAPS/OpenAPS.swift

+ 4 - 0
FreeAPS/Sources/APS/OpenAPS/OpenAPS.swift

@@ -332,6 +332,7 @@ final class OpenAPS {
             autosens: autosens.isEmpty ? .null : autosens
         )
 
+        // TODO: refactor this to core data
         if !simulation {
             storage.save(iob, as: Monitor.iob)
         }
@@ -355,9 +356,12 @@ final class OpenAPS {
         debug(.openAPS, "Determinated: \(orefDetermination)")
 
         if var determination = Determination(from: orefDetermination), let deliverAt = determination.deliverAt {
+            // set both timestamp and deliverAt to the SAME date; this will be updated for timestamp once it is enacted
+            // AAPS does it the same way! we'll follow their example!
             determination.timestamp = deliverAt
 
             if !simulation {
+                // save to core data asynchronously
                 await processDetermination(determination)
             }