allow tests to pass

Switching the way units is fetched to this way makes it similar to the other
code already in place that does something similar.  This allows the tests to
pass with the existing fixtures.
Considering augmenting  additional tests that explicitly tests whether the
relevant branch of code is taken.
This commit is contained in:
Ben West
2024-12-13 14:19:17 -08:00
parent a4e05a1655
commit 59ff28204a
+5 -5
View File
@@ -392,7 +392,7 @@ function init (ctx) {
function addSuggestion () {
if (prop.lastSuggested) {
var bg = prop.lastSuggested.bg;
var units = sbx.data.profile.getUnits();
var units = sbx.settings.units;
if (units === 'mmol') {
bg = Math.round(bg / consts.MMOL_TO_MGDL * 10) / 10;
@@ -479,11 +479,11 @@ function init (ctx) {
if ('enacted' === prop.status.code) {
var canceled = prop.lastEnacted.rate === 0 && prop.lastEnacted.duration === 0;
var bg = prop.lastEnacted.bg;
var units = sbx.data.profile.getUnits();
var units = sbx.settings.units;
if (units === 'mmol') {
bg = Math.round(bg / consts.MMOL_TO_MGDL * 10) / 10;
}
if (units === 'mmol') {
bg = Math.round(bg / consts.MMOL_TO_MGDL * 10) / 10;
}
var valueParts = [
valueString('BG: ', bg)