From ddce2b91cd59873200c1238fcf732498e952b08f Mon Sep 17 00:00:00 2001 From: PieterGit Date: Thu, 14 Sep 2017 19:16:32 +0200 Subject: [PATCH 01/43] decrease timeouts to detect regressions faster in future --- Makefile | 2 +- tests/admintools.test.js | 2 +- tests/hashauth.test.js | 5 ----- tests/profileeditor.test.js | 2 +- 4 files changed, 3 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 34f9030cb34..4c4a6b043ac 100644 --- a/Makefile +++ b/Makefile @@ -30,7 +30,7 @@ all: test coverage: NODE_ENV=test ${MONGO_SETTINGS} \ - ${ISTANBUL} cover ${MOCHA} -- --timeout 30000 -R tap ${TESTS} + ${ISTANBUL} cover ${MOCHA} -- --timeout 15000 -R tap ${TESTS} report: test -f ${ANALYZED} && \ diff --git a/tests/admintools.test.js b/tests/admintools.test.js index a2374ff1ff2..28462b0f9d6 100644 --- a/tests/admintools.test.js +++ b/tests/admintools.test.js @@ -57,7 +57,7 @@ var someData = { describe('admintools', function ( ) { var self = this; - this.timeout(30000); + this.timeout(20000); // TODO: see why this test takes longer on Travis to complete before(function (done) { benv.setup(function() { diff --git a/tests/hashauth.test.js b/tests/hashauth.test.js index 21f249a57a7..3f92f51d369 100644 --- a/tests/hashauth.test.js +++ b/tests/hashauth.test.js @@ -63,7 +63,6 @@ describe('hashauth', function ( ) { */ it ('should make module unauthorized', function () { - this.timeout(50000); var client = require('../lib/client'); var hashauth = require('../lib/hashauth'); @@ -82,7 +81,6 @@ describe('hashauth', function ( ) { }); it ('should make module authorized', function () { - this.timeout(50000); var client = require('../lib/client'); var hashauth = require('../lib/hashauth'); @@ -99,9 +97,6 @@ describe('hashauth', function ( ) { }); it ('should store hash and the remove authentication', function () { - - this.timeout(50000); - var client = require('../lib/client'); var hashauth = require('../lib/hashauth'); var localStorage = require('./fixtures/localstorage'); diff --git a/tests/profileeditor.test.js b/tests/profileeditor.test.js index 4791b139544..e34e080e9b4 100644 --- a/tests/profileeditor.test.js +++ b/tests/profileeditor.test.js @@ -71,7 +71,7 @@ var someData = { describe('Profile editor', function ( ) { - this.timeout(30000); + this.timeout(20000); //TODO: see why this test takes longer on Travis to complete var headless = require('./fixtures/headless')(benv, this); before(function (done) { From 2676cee355c2c4a2a5abd813c62276ac7bf45853 Mon Sep 17 00:00:00 2001 From: PieterGit Date: Thu, 14 Sep 2017 19:26:50 +0200 Subject: [PATCH 02/43] Admintools and profileeditor test fails with 20 sec timeout. Increasing to 25 sec. ``` not ok 1 admintools "before all" hook Error: timeout of 20000ms exceeded. Ensure the done() callback is being called in this test. at tests/admintools.test.js:177:7 at Object.done (node_modules/benv/index.js:32:21) at process.nextTick (node_modules/jsdom/lib/old-api.js:347:18) at _combinedTickCallback (internal/process/next_tick.js:131:7) at process._tickCallback (internal/process/next_tick.js:180:9) not ok 203 Profile editor "before each" hook for "should produce some html" Error: timeout of 20000ms exceeded. Ensure the done() callback is being called in this test. at tests/fixtures/headless.js:160:7 at Object.module.exports.setup (node_modules/benv/index.js:24:56) at Function.init [as setup] (tests/fixtures/headless.js:16:10) at Context. (tests/profileeditor.test.js:94:14) ``` --- tests/admintools.test.js | 2 +- tests/profileeditor.test.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/admintools.test.js b/tests/admintools.test.js index 28462b0f9d6..3419c4531ed 100644 --- a/tests/admintools.test.js +++ b/tests/admintools.test.js @@ -57,7 +57,7 @@ var someData = { describe('admintools', function ( ) { var self = this; - this.timeout(20000); // TODO: see why this test takes longer on Travis to complete + this.timeout(25000); // TODO: see why this test takes longer on Travis to complete before(function (done) { benv.setup(function() { diff --git a/tests/profileeditor.test.js b/tests/profileeditor.test.js index e34e080e9b4..3d601fed5f0 100644 --- a/tests/profileeditor.test.js +++ b/tests/profileeditor.test.js @@ -71,7 +71,7 @@ var someData = { describe('Profile editor', function ( ) { - this.timeout(20000); //TODO: see why this test takes longer on Travis to complete + this.timeout(25000); //TODO: see why this test takes longer on Travis to complete var headless = require('./fixtures/headless')(benv, this); before(function (done) { From 2caa67d5528a43f0c76884e41257e8765123a5a8 Mon Sep 17 00:00:00 2001 From: PieterGit Date: Thu, 14 Sep 2017 19:37:28 +0200 Subject: [PATCH 03/43] optimize travis tests. see if 5 sec per test is enough (in stead of 50 sec per test) --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 4c4a6b043ac..b3748228830 100644 --- a/Makefile +++ b/Makefile @@ -45,7 +45,7 @@ test: travis: NODE_ENV=test ${MONGO_SETTINGS} \ - ${ISTANBUL} cover ${MOCHA} --report lcovonly -- --timeout 50000 -R tap ${TESTS} + ${ISTANBUL} cover ${MOCHA} --report lcovonly -- --timeout 5000 -R tap ${TESTS} docker_release: # Get the version from the package.json file From ec06d5da3bff6971dbc9fe2508260ea9a21c8bf1 Mon Sep 17 00:00:00 2001 From: PieterGit Date: Thu, 14 Sep 2017 19:54:46 +0200 Subject: [PATCH 04/43] the following tests don't complete in 5 sec. increase timeout to 25 sec. --- tests/careportal.test.js | 2 ++ tests/hashauth.test.js | 2 ++ tests/pluginbase.test.js | 2 ++ 3 files changed, 6 insertions(+) diff --git a/tests/careportal.test.js b/tests/careportal.test.js index 1241ebe703a..80d99041c6d 100644 --- a/tests/careportal.test.js +++ b/tests/careportal.test.js @@ -13,6 +13,8 @@ var nowData = { }; describe('client', function ( ) { + this.timeout(25000); // TODO: see why this test takes longer on Travis to complete + var self = this; var headless = require('./fixtures/headless')(benv, this); diff --git a/tests/hashauth.test.js b/tests/hashauth.test.js index 3f92f51d369..8c115bdcacd 100644 --- a/tests/hashauth.test.js +++ b/tests/hashauth.test.js @@ -6,6 +6,8 @@ var read = require('fs').readFileSync; var serverSettings = require('./fixtures/default-server-settings'); describe('hashauth', function ( ) { + this.timeout(25000); // TODO: see why this test takes longer on Travis to complete + var self = this; var headless = require('./fixtures/headless')(benv, this); diff --git a/tests/pluginbase.test.js b/tests/pluginbase.test.js index c04f0c802ce..d9f44e36dd5 100644 --- a/tests/pluginbase.test.js +++ b/tests/pluginbase.test.js @@ -4,6 +4,8 @@ require('should'); var benv = require('benv'); describe('pluginbase', function ( ) { + this.timeout(25000); // TODO: see why this test takes longer on Travis to complete + var headless = require('./fixtures/headless')(benv, this); before(function (done) { From 2cadcb0f767827167bd6f2245f24f4ac857760f4 Mon Sep 17 00:00:00 2001 From: PieterGit Date: Thu, 14 Sep 2017 20:03:42 +0200 Subject: [PATCH 05/43] increase profileeditor tests to 40 sec --- tests/profileeditor.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/profileeditor.test.js b/tests/profileeditor.test.js index 3d601fed5f0..9c915027c84 100644 --- a/tests/profileeditor.test.js +++ b/tests/profileeditor.test.js @@ -71,7 +71,7 @@ var someData = { describe('Profile editor', function ( ) { - this.timeout(25000); //TODO: see why this test takes longer on Travis to complete + this.timeout(40000); //TODO: see why this test takes longer on Travis to complete var headless = require('./fixtures/headless')(benv, this); before(function (done) { From 2f46e051289a396f74084be43bcf0f79c616834a Mon Sep 17 00:00:00 2001 From: PieterGit Date: Thu, 14 Sep 2017 20:11:41 +0200 Subject: [PATCH 06/43] hasauth.test.js fails with 25 sec. increasing to 40 sec --- tests/hashauth.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/hashauth.test.js b/tests/hashauth.test.js index 8c115bdcacd..19fb50cc69e 100644 --- a/tests/hashauth.test.js +++ b/tests/hashauth.test.js @@ -6,7 +6,7 @@ var read = require('fs').readFileSync; var serverSettings = require('./fixtures/default-server-settings'); describe('hashauth', function ( ) { - this.timeout(25000); // TODO: see why this test takes longer on Travis to complete + this.timeout(40000); // TODO: see why this test takes longer on Travis to complete var self = this; var headless = require('./fixtures/headless')(benv, this); From 6adb76e81ee18b1294064e1fe7a64345a43bec9d Mon Sep 17 00:00:00 2001 From: Sulka Haro Date: Thu, 28 Sep 2017 19:57:13 +0300 Subject: [PATCH 07/43] Fixes hourly filtering in distrubution reports, reported in #2864 --- lib/report_plugins/glucosedistribution.js | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/lib/report_plugins/glucosedistribution.js b/lib/report_plugins/glucosedistribution.js index a2c5c6de6d6..7b0175a73ca 100644 --- a/lib/report_plugins/glucosedistribution.js +++ b/lib/report_plugins/glucosedistribution.js @@ -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') { @@ -291,14 +288,14 @@ glucosedistribution.report = function report_glucosedistribution(datastorage, so var tr = $(''); $('' + translate('Overall') + ': ').appendTo(tr); $(' ').appendTo(tr); - $('' + hourlyFilteredData.length + '').appendTo(tr); - if (hourlyFilteredData.length > 0) { - var localBgs = hourlyFilteredData.map(function(r) { + $('' + glucose_data.length + '').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; From e31cbb4586b945de8a5180179e6cbb97a515a87d Mon Sep 17 00:00:00 2001 From: John Weston Date: Fri, 6 Oct 2017 12:05:42 -0700 Subject: [PATCH 08/43] SVG dimension fix Somehow the NONE.svg ended up with an incorrect rectangle shape; fixed to match the aspect ratio of the other symbols. --- static/images/NONE.svg | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/static/images/NONE.svg b/static/images/NONE.svg index 382f288a3e8..397da4d77fe 100644 --- a/static/images/NONE.svg +++ b/static/images/NONE.svg @@ -1,3 +1,9 @@ - - - \ No newline at end of file + + + + + + From f28c3f9164f4bc1d08620e9481189817310f97bf Mon Sep 17 00:00:00 2001 From: MilosKozak Date: Sat, 7 Oct 2017 12:47:37 +0200 Subject: [PATCH 09/43] preserve original treatment collection --- lib/client/receiveddata.js | 2 +- lib/data/dataloader.js | 2 +- lib/data/ddata.js | 17 ++++++++++------- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/lib/client/receiveddata.js b/lib/client/receiveddata.js index aa05fe2e31a..e80b971710f 100644 --- a/lib/client/receiveddata.js +++ b/lib/client/receiveddata.js @@ -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); diff --git a/lib/data/dataloader.js b/lib/data/dataloader.js index 7a28abf190c..78b979e29a4 100644 --- a/lib/data/dataloader.js +++ b/lib/data/dataloader.js @@ -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) { diff --git a/lib/data/ddata.js b/lib/data/ddata.js index 08350a268e2..73b6bb4a37f 100644 --- a/lib/data/ddata.js +++ b/lib/data/ddata.js @@ -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) { @@ -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 = JSON.parse(JSON.stringify(profileTreatments)); + ddata.profileTreatments = ddata.processDurations(profileTreatments, true); // filter & prepare 'Combo Bolus' events ddata.combobolusTreatments = ddata.treatments.filter( function filterComboBoluses (t) { @@ -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 = JSON.parse(JSON.stringify(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 = JSON.parse(JSON.stringify(tempTargetTreatments)); + ddata.tempTargetTreatments = ddata.processDurations(tempTargetTreatments, false); }; From 4e1837d21cb35217cdc1b236f24213d481c3d6c4 Mon Sep 17 00:00:00 2001 From: John Weston Date: Mon, 9 Oct 2017 11:05:35 -0700 Subject: [PATCH 10/43] Remove pattern regex from basal change field Having the regex require integers means that only the numeric keypad will pop on iOS. This prevents the entry of negative values, which is pretty critical for temp basals. --- views/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/views/index.html b/views/index.html index c8ff1731ca0..237c0297a5c 100644 --- a/views/index.html +++ b/views/index.html @@ -339,7 +339,7 @@