Jon Mårtensson 4 лет назад
Родитель
Сommit
f7c18e2417
1 измененных файлов с 4 добавлено и 2 удалено
  1. 4 2
      FreeAPS/Resources/javascript/middleware/determine_basal.js

+ 4 - 2
FreeAPS/Resources/javascript/middleware/determine_basal.js

@@ -171,6 +171,8 @@ function middleware(iob, currenttemp, glucose, profile, autosens, meal, reservoi
             let oldBasalDuration = pumphistory[n]['duration (min)'] / 60;
             // time of old temp basal
             let oldTime = new Date(pumphistory[n].timestamp);
+            // timestamp in ms after the completed temp basal
+            let oldTimeAfterCompletedTempBasal = oldTime + oldBasalDuration * 36e5
             let newTime = oldTime;
             let o = n;
             do {
@@ -190,8 +192,8 @@ function middleware(iob, currenttemp, glucose, profile, autosens, meal, reservoi
             
             // if duration of scheduled basal is more than 0
             if (timeOfbasal > 0) {
-                let hour = oldTime.getHours();
-                let minutes = oldTime.getMinutes();
+                let hour = oldTimeAfterCompletedTempBasal.getHours();
+                let minutes = oldTimeAfterCompletedTempBasal.getMinutes();
                 let seconds = "00";
                 // "hour:minutes:00"
                 let timeString = "" + hour + ":" + minutes + ":" + seconds;