From a4e05a1655c7dd6b6707320295464f23b4fa450a Mon Sep 17 00:00:00 2001
From: dsnallfot <72826201+dsnallfot@users.noreply.github.com>
Date: Mon, 4 Mar 2024 17:16:20 +0100
Subject: [PATCH 1/5] Fix missing mmol unit conversion for lastEnacted.bg
---
lib/plugins/openaps.js | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/lib/plugins/openaps.js b/lib/plugins/openaps.js
index 81e7bc25a05..bbce600585d 100644
--- a/lib/plugins/openaps.js
+++ b/lib/plugins/openaps.js
@@ -478,9 +478,15 @@ 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();
+
+ if (units === 'mmol') {
+ bg = Math.round(bg / consts.MMOL_TO_MGDL * 10) / 10;
+ }
var valueParts = [
- valueString('BG: ', prop.lastEnacted.bg)
+ valueString('BG: ', bg)
, ', Temp Basal' + (canceled ? ' Canceled' : ' Started') + ''
, canceled ? '' : ' ' + prop.lastEnacted.rate.toFixed(2) + ' for ' + prop.lastEnacted.duration + 'm'
, valueString(', ', prop.lastEnacted.reason)
From 59ff28204af2f18243092ecf184aed1931cef466 Mon Sep 17 00:00:00 2001
From: Ben West
Date: Fri, 13 Dec 2024 14:09:55 -0800
Subject: [PATCH 2/5] 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.
---
lib/plugins/openaps.js | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/lib/plugins/openaps.js b/lib/plugins/openaps.js
index bbce600585d..3b3136a274b 100644
--- a/lib/plugins/openaps.js
+++ b/lib/plugins/openaps.js
@@ -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)
From 3761c0fedd455b6051f4d9a35a12fadddfe72991 Mon Sep 17 00:00:00 2001
From: Ben West
Date: Fri, 13 Dec 2024 14:28:49 -0800
Subject: [PATCH 3/5] permit any LTS version of node
---
lib/server/bootevent.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/server/bootevent.js b/lib/server/bootevent.js
index b377abcce98..7f09e130095 100644
--- a/lib/server/bootevent.js
+++ b/lib/server/bootevent.js
@@ -38,7 +38,7 @@ function boot (env, language) {
const isLTS = process.release.lts ? true : false;
- if (isLTS && (semver.satisfies(nodeVersion, '^20.0.0') || semver.satisfies(nodeVersion, '^18.0.0') || semver.satisfies(nodeVersion, '^16.0.0') || semver.satisfies(nodeVersion, '^14.0.0'))) {
+ if (isLTS || (semver.satisfies(nodeVersion, '^20.0.0') || semver.satisfies(nodeVersion, '^18.0.0') || semver.satisfies(nodeVersion, '^16.0.0') || semver.satisfies(nodeVersion, '^14.0.0'))) {
//Latest Node 14 LTS and Node 16 LTS are recommended and supported.
//Require at least Node 14 without known security issues
console.debug('Node LTS version ' + nodeVersion + ' is supported');
From ffd28b041ebc0ee42140319bbe0ac085f5fa2094 Mon Sep 17 00:00:00 2001
From: Ben West
Date: Fri, 13 Dec 2024 14:35:14 -0800
Subject: [PATCH 4/5] continuously test on lts also
This adds the latest long term support version of node to the automated testing
matrix.
---
.github/workflows/main.yml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index b3d49dc6332..3a05864a34d 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -16,7 +16,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
- node-version: [14.x, 16.x]
+ node-version: [14.x, 16.x, 20, lts]
mongodb-version: [4.4, 5.0, 6.0]
steps:
@@ -87,4 +87,4 @@ jobs:
platforms: ${{ env.PLATFORMS }}
tags: |
${{ env.DOCKER_IMAGE }}:${{ steps.package-version.outputs.current-version }}
- ${{ env.DOCKER_IMAGE }}:latest
\ No newline at end of file
+ ${{ env.DOCKER_IMAGE }}:latest
From 9195c3c275be4448080b692c52f0491a2340afc3 Mon Sep 17 00:00:00 2001
From: Ben West
Date: Fri, 13 Dec 2024 14:40:41 -0800
Subject: [PATCH 5/5] setup-node action syntax is lts/*
---
.github/workflows/main.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 3a05864a34d..be07a1061bb 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -16,7 +16,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
- node-version: [14.x, 16.x, 20, lts]
+ node-version: [14.x, 16.x, 20, lts/*]
mongodb-version: [4.4, 5.0, 6.0]
steps: