Skip to content

Commit a89f67a

Browse files
chesnerProivalkou
authored andcommitted
Added additional falsy check for sensitivityRatio (openaps#1137)
Added additional falsy check for sensitivityRatio in determine-basal to mitigate subsequent use from a possibly 'undefined' value, here for remainingCATimeMin
1 parent 36eceab commit a89f67a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/determine-basal/determine-basal.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -456,8 +456,10 @@ var determine_basal = function determine_basal(glucose_status, currenttemp, iob_
456456
ci = maxCI;
457457
}
458458
var remainingCATimeMin = 3; // h; duration of expected not-yet-observed carb absorption
459-
// adjust remainingCATime (instead of CR) for autosens
460-
remainingCATimeMin = remainingCATimeMin / sensitivityRatio;
459+
// adjust remainingCATime (instead of CR) for autosens if sensitivityRatio defined
460+
if (sensitivityRatio){
461+
remainingCATimeMin = remainingCATimeMin / sensitivityRatio;
462+
}
461463
// 20 g/h means that anything <= 60g will get a remainingCATimeMin, 80g will get 4h, and 120g 6h
462464
// when actual absorption ramps up it will take over from remainingCATime
463465
var assumedCarbAbsorptionRate = 20; // g/h; maximum rate to assume carbs will absorb if no CI observed

0 commit comments

Comments
 (0)