Updated titles and unknown-value responses

This commit is contained in:
inventor96
2019-09-16 15:12:59 -06:00
parent 450fbc2572
commit bf57dfec78
8 changed files with 41 additions and 26 deletions
+1 -1
View File
@@ -166,7 +166,7 @@ function init (ctx) {
var response = 'You are expected to be between ' + min + ' and ' + max + ' over the ' + moment(maxForecastMills).from(moment(sbx.time));
next('AR2 Forecast', response);
} else {
next('AR2 Forecast', 'AR2 plugin does not seem to be enabled');
next('AR2 Forecast', translate('virtAsstUnknown'));
}
}
+1 -1
View File
@@ -102,7 +102,7 @@ function init (ctx) {
function basalMessage(slots, sbx) {
var basalValue = sbx.data.profile.getTempBasal(sbx.time);
var response = 'Unable to determine current basal';
var response = translate('virtAsstUnknown');
var preamble = '';
if (basalValue.treatment) {
preamble = (slots && slots.pwd && slots.pwd.value) ? translate('virtAsstPreamble3person', {
-2
View File
@@ -247,11 +247,9 @@ function init(ctx) {
var message = translate('virtAsstIobIntent', {
params: [
//preamble,
getIob(sbx)
]
});
//preamble + + ' insulin on board';
callback('Current IOB', message);
}
+9 -5
View File
@@ -441,7 +441,7 @@ function init (ctx) {
var startPrediction = moment(sbx.properties.loop.lastLoop.predicted.startDate);
var endPrediction = startPrediction.clone().add(maxForecastIndex * 5, 'minutes');
if (endPrediction.valueOf() < sbx.time) {
next('Loop Forecast', 'Unable to forecast with the data that is available');
next('Loop Forecast', translate('virtAsstUnknown'));
} else {
for (var i = 1, len = forecast.slice(0, maxForecastIndex).length; i < len; i++) {
if (forecast[i] > max) {
@@ -461,14 +461,18 @@ function init (ctx) {
next('Loop Forecast', response);
}
} else {
next('Loop forecast', 'Loop plugin does not seem to be enabled');
next('Loop Forecast', translate('virtAsstUnknown'));
}
}
function virtAsstLastLoopHandler (next, slots, sbx) {
console.log(JSON.stringify(sbx.properties.loop.lastLoop));
var response = 'The last successful loop was ' + moment(sbx.properties.loop.lastOkMoment).from(moment(sbx.time));
next('Last loop', response);
if (sbx.properties.loop.lastLoop) {
console.log(JSON.stringify(sbx.properties.loop.lastLoop));
var response = 'The last successful loop was ' + moment(sbx.properties.loop.lastOkMoment).from(moment(sbx.time));
next('Last Loop', response);
} else {
next('Last Loop', translate('virtAsstUnknown'));
}
}
loop.virtAsst = {
+13 -7
View File
@@ -518,17 +518,23 @@ function init (ctx) {
]
});
next('Loop Forecast', response);
} else {
next('Loop Forecast', translate('virtAsstUnknown'));
}
}
function virtAsstLastLoopHandler (next, slots, sbx) {
console.log(JSON.stringify(sbx.properties.openaps.lastLoopMoment));
var response = translate('virtAsstLastLoop', {
params: [
moment(sbx.properties.openaps.lastLoopMoment).from(moment(sbx.time))
]
});
next('Last loop', response);
if (sbx.properties.openaps.lastLoopMoment) {
console.log(JSON.stringify(sbx.properties.openaps.lastLoopMoment));
var response = translate('virtAsstLastLoop', {
params: [
moment(sbx.properties.openaps.lastLoopMoment).from(moment(sbx.time))
]
});
next('Last Loop', response);
} else {
next('Last Loop', translate('virtAsstUnknown'));
}
}
openaps.virtAsst = {
+5 -6
View File
@@ -136,16 +136,15 @@ function init (ctx) {
};
function virtAsstReservoirHandler (next, slots, sbx) {
var reservoir = _.get(sbx, 'properties.pump.pump.reservoir');
if (reservoir) {
if (sbx.properties.pump.pump.reservoir) {
var response = translate('virtAsstReservoir', {
params: [
reservoir
]
});
next('Remaining insulin', response);
next('Remaining Insulin', response);
} else {
next('Remaining insulin', translate('virtAsstUnknown'));
next('Remaining Insulin', translate('virtAsstUnknown'));
}
}
@@ -158,9 +157,9 @@ function init (ctx) {
battery.unit
]
});
next('Pump battery', response);
next('Pump Battery', response);
} else {
next('Pump battery', translate('virtAsstUnknown'));
next('Pump Battery', translate('virtAsstUnknown'));
}
}
+6 -2
View File
@@ -107,8 +107,12 @@ function init (ctx) {
};
function virtAsstRawBGHandler (next, slots, sbx) {
var response = 'Your raw bg is ' + sbx.properties.rawbg.mgdl;
next('Current Raw BG', response);
if (sbx.properties.rawbg.mgdl) {
var response = 'Your raw bg is ' + sbx.properties.rawbg.mgdl;
next('Current Raw BG', response);
} else {
next('Current Raw BG', translate('virtAsstUnknown'));
}
}
rawbg.virtAsst = {
+6 -2
View File
@@ -222,8 +222,12 @@ function init() {
};
function virtAsstUploaderBatteryHandler (next, slots, sbx) {
var response = 'Your uploader battery is at ' + sbx.properties.upbat.display;
next('Uploader battery', response);
if (sbx.properties.upbat.display) {
var response = 'Your uploader battery is at ' + sbx.properties.upbat.display;
next('Uploader Battery', response);
} else {
next('Uploader Battery', translate('virtAsstUnknown'));
}
}
upbat.virtAsst = {