Skip to content

Commit

Permalink
Merge branch 'dev' into ZT
Browse files Browse the repository at this point in the history
Conflicts:
	package-lock.json
  • Loading branch information
scottleibrand committed Oct 15, 2017
2 parents 349bc02 + 1c387b8 commit 4ba9b3e
Show file tree
Hide file tree
Showing 13 changed files with 106 additions and 59 deletions.
2 changes: 1 addition & 1 deletion app.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ function create(env, ctx) {
json_match: /json/,
uglifyJS: myUglifyJS,
cssmin: myCssmin,
cache: __dirname + '/cache',
cache: __dirname + '/tmp',
onerror: undefined,
}));

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nightscout",
"version": "0.10.0-dev-20170716",
"version": "0.10.2-dev-20171016",
"dependencies": {
"colorbrewer": "~1.0.0",
"jQuery-Storage-API": "~1.7.2",
Expand Down
2 changes: 1 addition & 1 deletion lib/client/receiveddata.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ function receiveDData (received, ddata, settings) {
ddata.mbgs = mergeDataUpdate(received.delta, ddata.mbgs, received.mbgs);
ddata.treatments = mergeTreatmentUpdate(received.delta, ddata.treatments, received.treatments);

ddata.processTreatments(true);
ddata.processTreatments(false);

// Do some reporting on the console
// console.log('Total SGV data size', ddata.sgvs.length);
Expand Down
2 changes: 1 addition & 1 deletion lib/data/dataloader.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function init(env, ctx) {
if (err) {
console.error(err);
}
ddata.processTreatments(false);
ddata.processTreatments(true);

var counts = [];
_.forIn(ddata, function each (value, key) {
Expand Down
17 changes: 10 additions & 7 deletions lib/data/ddata.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ function init( ) {
}
};

ddata.processTreatments = function processTreatments (callProcessDurations ) {
ddata.processTreatments = function processTreatments (preserveOrignalTreatments ) {

// filter & prepare 'Site Change' events
ddata.sitechangeTreatments = ddata.treatments.filter( function filterSensor (t) {
Expand All @@ -184,8 +184,9 @@ function init( ) {
var profileTreatments = ddata.treatments.filter( function filterProfiles (t) {
return t.eventType === 'Profile Switch';
}).sort(function (a,b) { return a.mills > b.mills; });
if (callProcessDurations)
ddata.profileTreatments = ddata.processDurations(profileTreatments, true);
if (preserveOrignalTreatments)
profileTreatments = _.cloneDeep(profileTreatments);
ddata.profileTreatments = ddata.processDurations(profileTreatments, true);

// filter & prepare 'Combo Bolus' events
ddata.combobolusTreatments = ddata.treatments.filter( function filterComboBoluses (t) {
Expand All @@ -196,15 +197,17 @@ function init( ) {
var tempbasalTreatments = ddata.treatments.filter( function filterBasals (t) {
return t.eventType && t.eventType.indexOf('Temp Basal') > -1;
});
if (callProcessDurations)
ddata.tempbasalTreatments = ddata.processDurations(tempbasalTreatments, false);
if (preserveOrignalTreatments)
tempbasalTreatments = _.cloneDeep(tempbasalTreatments);
ddata.tempbasalTreatments = ddata.processDurations(tempbasalTreatments, false);

// filter temp target
var tempTargetTreatments = ddata.treatments.filter( function filterTargets (t) {
return t.eventType && t.eventType.indexOf('Temporary Target') > -1;
});
if (callProcessDurations)
ddata.tempTargetTreatments = ddata.processDurations(tempTargetTreatments, false);
if (preserveOrignalTreatments)
tempTargetTreatments = _.cloneDeep(tempTargetTreatments);
ddata.tempTargetTreatments = ddata.processDurations(tempTargetTreatments, false);

};

Expand Down
36 changes: 18 additions & 18 deletions lib/language.js
Original file line number Diff line number Diff line change
Expand Up @@ -8210,7 +8210,7 @@ function init() {
,de: 'Insulin-Alter'
,bg: 'Възраст на инсулина (ВИ)'
,ro: 'Vechimea insulinei'
,ru: 'Возраст инсулина'
,ru: 'инсулин проработал'
,nl: 'Insuline leeftijd (IAGE)'
,ko: '인슐린 사용 기간'
,fi: 'Insuliinin ikä'
Expand Down Expand Up @@ -8633,7 +8633,7 @@ function init() {
cs: 'Subjekty - Lidé, zařízení atd.'
,bg: 'Субекти - Хора,Устройства,т.н.'
,ro: 'Subiecte - Persoane, dispozitive, etc'
,ru: 'Люди, устройства и т п'
,ru: 'Субъекты - Люди, устройства и т п'
,sv: 'Ämnen - Användare, Enheter, etc'
,nb: 'Ressurser - Brukere, enheter osv'
,fi: 'Käyttäjät (Ihmiset, laitteet jne)'
Expand Down Expand Up @@ -10201,7 +10201,7 @@ function init() {
, pl: 'slightly dropping'
, pt: 'slightly dropping'
, ro: 'slightly dropping'
, ru: 'slightly dropping'
, ru: 'незначительное падение'
, sk: 'slightly dropping'
, sv: 'slightly dropping'
, zh_cn: 'slightly dropping'
Expand All @@ -10225,7 +10225,7 @@ function init() {
, pl: 'slightly rising'
, pt: 'slightly rising'
, ro: 'slightly rising'
, ru: 'slightly rising'
, ru: 'незначительный подъем'
, sk: 'slightly rising'
, sv: 'slightly rising'
, zh_cn: 'slightly rising'
Expand All @@ -10249,7 +10249,7 @@ function init() {
, pl: 'holding'
, pt: 'holding'
, ro: 'holding'
, ru: 'holding'
, ru: 'ровный'
, sk: 'holding'
, sv: 'holding'
, zh_cn: 'holding'
Expand All @@ -10273,7 +10273,7 @@ function init() {
, pl: 'rising'
, pt: 'rising'
, ro: 'rising'
, ru: 'rising'
, ru: 'растет'
, sk: 'rising'
, sv: 'rising'
, zh_cn: 'rising'
Expand All @@ -10297,7 +10297,7 @@ function init() {
, pl: 'dropping'
, pt: 'dropping'
, ro: 'dropping'
, ru: 'dropping'
, ru: 'падает'
, sk: 'dropping'
, sv: 'dropping'
, zh_cn: 'dropping'
Expand All @@ -10321,7 +10321,7 @@ function init() {
, pl: 'rapidly dropping'
, pt: 'rapidly dropping'
, ro: 'rapidly dropping'
, ru: 'rapidly dropping'
, ru: 'быстро падает'
, sk: 'rapidly dropping'
, sv: 'rapidly dropping'
, zh_cn: 'rapidly dropping'
Expand All @@ -10345,7 +10345,7 @@ function init() {
, pl: 'rapidly rising'
, pt: 'rapidly rising'
, ro: 'rapidly rising'
, ru: 'rapidly rising'
, ru: 'быстро растет'
, sk: 'rapidly rising'
, sv: 'rapidly rising'
, zh_cn: 'rapidly rising'
Expand All @@ -10369,7 +10369,7 @@ function init() {
, pl: '%1 and %2 as of %3.'
, pt: '%1 and %2 as of %3.'
, ro: '%1 and %2 as of %3.'
, ru: '%1 and %2 as of %3.'
, ru: '%1 и %2 начиная с %3.'
, sk: '%1 and %2 as of %3.'
, sv: '%1 and %2 as of %3.'
, zh_cn: '%1 and %2 as of %3.'
Expand All @@ -10393,7 +10393,7 @@ function init() {
, pl: '%1 current basal is %2 units per hour'
, pt: '%1 current basal is %2 units per hour'
, ro: '%1 current basal is %2 units per hour'
, ru: '%1 current basal is %2 units per hour'
, ru: '%1 текущий базал %2 ед в час'
, sk: '%1 current basal is %2 units per hour'
, sv: '%1 current basal is %2 units per hour'
, zh_cn: '%1 current basal is %2 units per hour'
Expand All @@ -10417,7 +10417,7 @@ function init() {
, pl: '%1 temp basal of %2 units per hour will end %3'
, pt: '%1 temp basal of %2 units per hour will end %3'
, ro: '%1 temp basal of %2 units per hour will end %3'
, ru: '%1 temp basal of %2 units per hour will end %3'
, ru: '%1 временный базал %2 ед в час закончится в %3'
, sk: '%1 temp basal of %2 units per hour will end %3'
, sv: '%1 temp basal of %2 units per hour will end %3'
, zh_cn: '%1 temp basal of %2 units per hour will end %3'
Expand All @@ -10441,7 +10441,7 @@ function init() {
, pl: 'and you have %1 insulin on board.'
, pt: 'and you have %1 insulin on board.'
, ro: 'and you have %1 insulin on board.'
, ru: 'and you have %1 insulin on board.'
, ru: 'и вы имеете %1 инсулина в организме.'
, sk: 'and you have %1 insulin on board.'
, sv: 'and you have %1 insulin on board.'
, zh_cn: 'and you have %1 insulin on board.'
Expand All @@ -10465,7 +10465,7 @@ function init() {
, pl: 'You have %1 insulin on board'
, pt: 'You have %1 insulin on board'
, ro: 'You have %1 insulin on board'
, ru: 'You have %1 insulin on board'
, ru: 'вы имеете %1 инсулина в организме'
, sk: 'You have %1 insulin on board'
, sv: 'You have %1 insulin on board'
, zh_cn: 'You have %1 insulin on board'
Expand All @@ -10489,7 +10489,7 @@ function init() {
, pl: '%1 units of'
, pt: '%1 units of'
, ro: '%1 units of'
, ru: '%1 units of'
, ru: '%1 единиц'
, sk: '%1 units of'
, sv: '%1 units of'
, zh_cn: '%1 units of'
Expand All @@ -10513,7 +10513,7 @@ function init() {
, pl: 'Your'
, pt: 'Your'
, ro: 'Your'
, ru: 'Your'
, ru: 'ваш'
, sk: 'Your'
, sv: 'Your'
, zh_cn: 'Your'
Expand All @@ -10536,7 +10536,7 @@ function init() {
, nb: '%1 has a '
, pl: '%1 has a '
, pt: '%1 has a '
, ro: '%1 has a '
, ro: '%1 имеет '
, ru: '%1 has a '
, sk: '%1 has a '
, sv: '%1 has a '
Expand All @@ -10561,7 +10561,7 @@ function init() {
, pl: 'no'
, pt: 'no'
, ro: 'no'
, ru: 'no'
, ru: 'нет'
, sk: 'no'
, sv: 'no'
, zh_cn: 'no'
Expand Down
34 changes: 33 additions & 1 deletion lib/plugins/loop.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,36 @@ function init(ctx) {
}
}

function addRSSI() {

var lastTuned = "";
var RSSI = "";

_.forEach(sbx.data.devicestatus, function(entry) {
if (entry.radioAdapter) {
var entryMoment = moment(entry.radioAdapter.lastTuned);
if (lastTuned == "") {
lastTuned = entryMoment;
RSSI = entry.radioAdapter.pumpRSSI;
}
if (lastTuned < entryMoment) {
lastTuned = entryMoment;
RSSI = entry.radioAdapter.pumpRSSI;
}
}
});

if (RSSI != "") {

RSSI = "Pump RSSI: " + RSSI;

events.push({
time: lastTuned
, value: RSSI
});
}
}

function addLastEnacted() {
if (prop.lastEnacted) {
var canceled = prop.lastEnacted.rate === 0 && prop.lastEnacted.duration === 0;
Expand Down Expand Up @@ -283,8 +313,10 @@ function init(ctx) {
} else if ('looping' === prop.display.code) {
addLastEnacted();
} else {
addRecommendedTempBasal();
addRecommendedTempBasal();
}

addRSSI();

var sorted = _.sortBy(events, function toMill(event) {
return event.time.valueOf();
Expand Down
15 changes: 6 additions & 9 deletions lib/report_plugins/glucosedistribution.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,17 +217,14 @@ glucosedistribution.report = function report_glucosedistribution(datastorage, so
prevEntry = entry;
}

glucose_data = data = glucose_data2;


var hourlyFilteredData = data.filter(function(r) {
glucose_data = data = glucose_data2.filter(function(r) {
return enabledHours[new Date(r.displayTime).getHours()]
});

['Low', 'Normal', 'High'].forEach(function(range) {
result[range] = {};
var r = result[range];
r.rangeRecords = hourlyFilteredData.filter(function(r) {
r.rangeRecords = glucose_data.filter(function(r) {
if (range === 'Low') {
return r.sgv > 0 && r.sgv < options.targetLow;
} else if (range === 'Normal') {
Expand Down Expand Up @@ -291,14 +288,14 @@ glucosedistribution.report = function report_glucosedistribution(datastorage, so
var tr = $('<tr>');
$('<td class="tdborder"><strong>' + translate('Overall') + ': </strong></td>').appendTo(tr);
$('<td> </td>').appendTo(tr);
$('<td class="tdborder">' + hourlyFilteredData.length + '</td>').appendTo(tr);
if (hourlyFilteredData.length > 0) {
var localBgs = hourlyFilteredData.map(function(r) {
$('<td class="tdborder">' + glucose_data.length + '</td>').appendTo(tr);
if (glucose_data.length > 0) {
var localBgs = glucose_data.map(function(r) {
return r.sgv;
}).filter(function(bg) {
return !!bg;
});
var mgDlBgs = hourlyFilteredData.map(function(r) {
var mgDlBgs = glucose_data.map(function(r) {
return r.bgValue;
}).filter(function(bg) {
return !!bg;
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Nightscout",
"version": "0.10.1-dev-20170923",
"version": "0.10.2-dev-20171016",
"description": "Nightscout acts as a web-based CGM (Continuous Glucose Montinor) to allow multiple caregivers to remotely view a patients glucose data in realtime.",
"license": "AGPL-3.0",
"author": "Nightscout Team",
Expand Down Expand Up @@ -28,9 +28,9 @@
"test": "make test",
"env": "env",
"postinstall": "webpack --config webpack.config.js && npm run-script update-buster",
"bundle": "webpack --config webpack.config.js",
"bundle": "webpack --config webpack.config.js && npm run-script update-buster",
"bower": "node node_modules/bower/bin/bower --allow-root install && ",
"update-buster": "node scripts/generateCacheBuster.js >tmp/cacheBusterToken"
"update-buster": "node bin/generateCacheBuster.js >tmp/cacheBusterToken"
},
"config": {
"blanket": {
Expand Down
Loading

0 comments on commit 4ba9b3e

Please sign in to comment.