mirror of
https://github.com/bckelley/cgm-remote-monitor.git
synced 2026-08-24 03:14:12 -05:00
wait till all deviceInfos are collected before checking length
This commit is contained in:
+12
-10
@@ -194,7 +194,7 @@ function init (ctx) {
|
||||
|
||||
var deviceInfos = { };
|
||||
|
||||
if (prop.sgvs && prop.sgvs.length > 1) {
|
||||
if (prop.sgvs) {
|
||||
_.forEach(prop.sgvs, function deviceAndValue(entry) {
|
||||
var device = utils.deviceName(entry.device);
|
||||
deviceInfos[device] = {
|
||||
@@ -205,7 +205,7 @@ function init (ctx) {
|
||||
});
|
||||
}
|
||||
|
||||
if (delta && delta.previous && delta.previous.sgvs && delta.previous.sgvs.length > 1) {
|
||||
if (delta && delta.previous && delta.previous.sgvs) {
|
||||
_.forEach(delta.previous.sgvs, function deviceAndValue(entry) {
|
||||
var device = utils.deviceName(entry.device);
|
||||
var deviceInfo = deviceInfos[device];
|
||||
@@ -227,16 +227,18 @@ function init (ctx) {
|
||||
}
|
||||
});
|
||||
|
||||
_.forIn(deviceInfos, function addInfo (deviceInfo, name) {
|
||||
var display = deviceInfo.value;
|
||||
if (deviceInfo.delta) {
|
||||
display += ' ' + deviceInfo.delta;
|
||||
}
|
||||
if (_.keys(deviceInfos).length > 1) {
|
||||
_.forIn(deviceInfos, function addInfo(deviceInfo, name) {
|
||||
var display = deviceInfo.value;
|
||||
if (deviceInfo.delta) {
|
||||
display += ' ' + deviceInfo.delta;
|
||||
}
|
||||
|
||||
display += ' (' + deviceInfo.time + ')';
|
||||
display += ' (' + deviceInfo.time + ')';
|
||||
|
||||
info.push({label: name, value: display});
|
||||
});
|
||||
info.push({label: name, value: display});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
sbx.pluginBase.updatePillText({
|
||||
|
||||
Reference in New Issue
Block a user