Skip to content

Commit

Permalink
allow tests to pass
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
bewest committed Dec 13, 2024
1 parent a4e05a1 commit 59ff282
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/plugins/openaps.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 59ff282

Please sign in to comment.