Skip to content
This repository has been archived by the owner on Aug 29, 2022. It is now read-only.

Commit

Permalink
Update to latest (#1)
Browse files Browse the repository at this point in the history
* decrease timeouts to detect regressions faster in future

* 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.<anonymous> (tests/profileeditor.test.js:94:14)
```

* optimize travis tests. see if 5 sec per test is enough (in stead of 50 sec per test)

* the following tests don't complete in 5 sec. increase timeout to 25 sec.

* increase profileeditor tests to 40 sec

* hasauth.test.js fails with 25 sec.  increasing to 40 sec

* Create issue_template.md

Adding an issue template to help solve bugs

* add ZT (zero temp) prediction line

* package-lock.json

* display ZT PredBGs, and forecast tooltips

* remove extra-big tooltip target around treatments; reduce font sizes

* make R3/R4 elements into very short arcs to reposition labels

* filter to only use actual SGV's (not rawbg's) to set the view window

* remove console.log

* Update dev version to 0.10.2

* exclude package-lock.json from git

* add package-lock.json to .gitignore to avoid merge conflicts

* comments

* revert font change

* Adding some test coverage for /lib/client/renderer.js

* send foods via websockets

* use websockeets instead of rest api for food

* add fat,protein,energy to food editor

* Re-enable source maps

* replace 3HR with 2HR and (default) 4HR views

* only show focusHours' worth of predictions; strip leading zero from bolus amounts

* fix spelling of focusRangeMS

* change default back to 3HR

* try larger label font: 35 instead of 25 (vs. 40)

* allow treatment bubbles to scale up past 1U/20g size

* change font size back to default in this branch

* change Bolus Snooze to Bolus IOB

* change Bolus Snooze to Bolus IOB

* back to smaller treatment dots

* handle AAPS profile switches well

* Fix URLs of [mongostring] and [autoconfigure]

* update nodejs to 8.7.0 and npm update

* do not upload temporary profiles from store

* also update nodjes used by travis from 8.5.0 to 8.7.0

* Increase timeout for careportal.test.js and pluginbase.test from 25 to 30 sec., just to be sure. I seem to work once with Node 8.7.0, but the test did a timeout once on Node 8.5.0 on Travis.

* increase timeout of admintools.test.js from 25 to 30 seconds

* pluginbase.test.js fails with 30 sec. upping to 40 sec timeout

```
not ok 188 pluginbase "before each" hook for "does stuff"
 Error: timeout of 30000ms exceeded. Ensure the done() callback is being called in this test.
```

* update to nodejs 8.8.0 and npm update

* npm update with nodejs 8.8.0

* Update version, remove package-lock.json

* upgrade node in .nvmrc from 8.1.4 to 8.8.0
set travis container to dist: trusty and give sudo: false a try

* set sudo back to required (used for docker and mongodb commands)

* more node upgrade stuff

* Update README.md

* Fix a bug with time comparison on if-modified-since support for treatments

* Check both created_at and timestamp fields for treatments in if-modified-since logic

* Add Total daily pasal to profile editor.

Small improvoment to profile editor while geting familiar
about the code. Added a simple estimated total daily basal field.

* Bump 8.8.0 to 8.8.1

* cherry pick 33f16f4

* merge rendering

* Revert "add package-lock.json to .gitignore to avoid merge conflicts"

This reverts commit ec25130.
We now use  npm-shrinkwrap.json

* fix merge errors, up version and fix test

fix merge errros by reverting views/index.html and lib/client/renderer.js,
up version in bower.json, npm-shrinkwrap.json and package.json
fix test/client.renderer.test.js

* bring back the ' U' for non-SMB's (> 1U insulin and with carbs)

* Revert "bring back the ' U' for non-SMB's (> 1U insulin and with carbs)"

This reverts commit edbf22b.

* fix typo foucusRangeMS to focusRangeMS in lib/client/chart.js

* for some reasone change from foucusRangeMS to focusRangeMS was not implemented in lib/client/index.js

This was fixed on ZT branch in nightscout@38d3539

* bring back the ' U' for non-SMB's (> 1U insulin and with carbs)

* More test coverage for /lib/client/renderer.js (highlightBrushPoints)

* display Sensitivity Ratio in OpenAPS pill

* add comma

* Fix SAGE pill test failing due to summer time change

* Upgrading to 8.9.0 LTS (first LTS release!) and also let travis run on both Node 8.9.0 and Node 9.0.0 (to make sure we don't introduce future problems with Node 9.0.0).
Node 8.9.0 LTS will be the recommended version.

* Drop building with nodejs 9.0.0 for now. Once NodeJS v10 almost appears were gonna test against that version.

* Update German translation

* Update German translation

* added dutch translations

* Update Loop pill RSSI (nightscout#3034)

* Update package.json

* update package.json

* Update loop.js

* test

* add BLE RSSI

* add BLE RSSI

* update RSSI time stamp

* update Loop RSSI reporting

* update Loop RSSI reporting

* show RSSI and pumpRSSI in Loop pill, if available

* update Loop pill RSSI

* Update RSSI in Loop pill

* Upgrade to node 8.9.1 and npm update and some dutch translation fixes (nightscout#3037)

* upgrade to node 8.9.1

* further improve dutch language

* remove duplicate dutch line Filter

* remove dutch language.js record that was defined two times

* fix duplicate german language record

* reapply npm-shrinkwrap.json to fix unit tests

* another try to get a proper npm-shrinkwrap.json

* shorten minutes ago in dutch to improve formatting of status pills

* deviceInfo.recent null check (nightscout#3048)

* add root mean squared out of range metric (nightscout#3045)

* Add recommended bolus and eventual BG to Loop pill (nightscout#3040)

* Update package.json

* update package.json

* Update loop.js

* test

* add BLE RSSI

* add BLE RSSI

* update RSSI time stamp

* update Loop RSSI reporting

* update Loop RSSI reporting

* show RSSI and pumpRSSI in Loop pill, if available

* update Loop pill RSSI

* Update RSSI in Loop pill

* Add recommended bolus to Loop pill

* Add eventual BG to Loop pill

* Update test for Loop pill with eventual BG

* Update test for Loop pill with eventual BG

* Update bgclock.html (nightscout#3039)

* Update index.html

* Update index.html

* Update index.html

* Update index.html

Remove alarms.

* Update index.html

* Update index.html

Removed alarms:

Line 669 & 670
            <audio src="audio/alarm.mp3" preload="auto" loop="true" class="alarm mp3" type="audio/mp3"></audio>
	    <audio src="audio/alarm2.mp3" preload="auto" loop="true" class="urgent alarm2 mp3" type="audio/mp3"></audio>

* Add Trend Arrow

Add Trend Arrow to glucose value

* Update index.html

* Update version, improvements to glucose distribution filtering

* fix reports (nightscout#3078)

* fix profile functions

* fix loading of profile switch treatments

* Shrinkwrap update

* Downgrade npm to fix deployment issues

* Smarter formatting based on amount of data (nightscout#3086)

* Smarter formatting based on amount of data, to make sure the rendering works for both SMB and non-SMB users

* Move comment to where it belongs, changed math so first 10 treatments don't reduce scaling

*  better rendering of treatments with duration (nightscout#3082)

* fix profile functions

* fix loading of profile switch treatments

* better rendering treatments with duration

* * Update Finnish localization
* Change SMB visualization to be more friendly
* Add BG Clock to navigation
* Updated release version

* 24 hour clock support for bgclock.html

* Going down to 8.9.0 for Azure

* Alternate versions in package.json

* One final change that should run on both Heroku and Azure
  • Loading branch information
Mathwhiz authored Feb 13, 2018
1 parent 9f7de63 commit 6f97c28
Show file tree
Hide file tree
Showing 43 changed files with 1,750 additions and 751 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ node_modules/

bundle/bundle.out.js

.vscode/
.idea/
*.iml
my.env
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8.1.4
8.9.1
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
language: node_js
sudo: required
dist: trusty
node_js:
- "8.5.0"
- "8.9.1"
matrix:
fast_finish: true
services:
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.example
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:8.5.0
FROM node:8.9.1

MAINTAINER Nightscout Contributors

Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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} && \
Expand All @@ -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
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,24 +105,24 @@ Community maintained fork of the

Requirements:

- [Node.js](http://nodejs.org/)
- [Node.js](http://nodejs.org/) 8.9.0 LTS (use [Install instructions for Node](https://nodejs.org/en/download/package-manager/) or `setup.sh`)

Clone this repo then install dependencies into the root of the project:

```bash
$ npm install
```

If deploying the software to Microsoft Azure, you must set *WEBSITE_NODE_DEFAULT_VERSION* in the app settings to *8.5.0* or the site deployment will fail. Other hosting environments do not require this setting.
If deploying the software to Microsoft Azure, you must set *WEBSITE_NODE_DEFAULT_VERSION* in the app settings to *8.9.0* **before** you deploy the latest Nightscout or the site deployment will likely fail. Other hosting environments do not require this setting.

# Usage

The data being uploaded from the server to the client is from a
MongoDB server such as [mongolab][mongodb].

[mongodb]: https://mongolab.com
[autoconfigure]: http://nightscout.github.io/pages/configure/
[mongostring]: http://nightscout.github.io/pages/mongostring/
[autoconfigure]: https://nightscout.github.io/pages/configure/
[mongostring]: https://nightscout.github.io/pages/mongostring/
[update-fork]: http://nightscout.github.io/pages/update-fork/

## Updating my version?
Expand Down
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.1-release-20171016",
"version": "0.10.2-release-20171201",
"dependencies": {
"colorbrewer": "~1.0.0",
"jQuery-Storage-API": "~1.7.2",
Expand Down
11 changes: 11 additions & 0 deletions docs/issue_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Please include the following information with your bug report:

Is this a new bug with the latest release, have you seen this earlier?

Which device / browser version was used to reproduce the bug?

Does this happen every time you launch Nightscout, or sometimes?

Steps how to reproduce (if you can’t reproduce the issue, please don’t report the issue / if we can't reproduce the bug, we can't fix)

Please include 1 or more screenshots of the issue appearing, ideally with an annotation on what's wrong
2 changes: 1 addition & 1 deletion lib/api/entries/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ function configure (app, wares, ctx) {
var ifModifiedSince = req.get('If-Modified-Since');
if (!ifModifiedSince) { return next(); }

if (lastEntryDate <= new Date(ifModifiedSince)) {
if (lastEntryDate.getTime() <= new Date(ifModifiedSince).getTime()) {
res.status(304).send({status:304, message: 'Not modified', type:'internal'});
return;
}
Expand Down
17 changes: 14 additions & 3 deletions lib/api/treatments/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

var _ = require('lodash');
var consts = require('../../constants');
var moment = require('moment');

function configure(app, wares, ctx) {
var express = require('express')
Expand Down Expand Up @@ -39,16 +40,26 @@ function configure(app, wares, ctx) {
t.carbs = Number(t.carbs);
t.insulin = Number(t.insulin);

var d2 = new Date(t.timestamp);
var d2 = null;

if (d1 == null || d2 > d1) {
if (t.hasOwnProperty('created_at')) {
d2 = new Date(t.created_at);
} else {
if (t.hasOwnProperty('timestamp')) {
d2 = new Date(t.timestamp);
}
}

if (d2 == null) { return; }

if (d1 == null || d2.getTime() > d1.getTime()) {
d1 = d2;
}
});

if (!_.isNil(d1)) res.setHeader('Last-Modified', d1.toUTCString());

if (ifModifiedSince && d1 <= new Date(ifModifiedSince)) {
if (ifModifiedSince && d1.getTime() <= moment(ifModifiedSince).valueOf()) {
res.status(304).send({
status: 304
, message: 'Not modified'
Expand Down
54 changes: 27 additions & 27 deletions lib/client/boluscalc.js
Original file line number Diff line number Diff line change
Expand Up @@ -621,41 +621,41 @@ function init(client, $) {
boluscalc.loadFoodDatabase = function loadFoodDatabase(event, callback) {
categories = [];
foodlist = [];
$.ajax('/api/v1/food/regular.json', {
headers: client.headers()
, success: function (records) {
records.forEach(function (r) {
foodlist.push(r);
if (r.category && !categories[r.category]) {
categories[r.category] = {};
}
if (r.category && r.subcategory) {
categories[r.category][r.subcategory] = true;
}
});
databaseloaded = true;
console.log('Food database loaded');
fillForm();
var records = client.sbx.data.food || [];
records.forEach(function (r) {
if (r.type == 'food') {
foodlist.push(r);
if (r.category && !categories[r.category]) {
categories[r.category] = {};
}
if (r.category && r.subcategory) {
categories[r.category][r.subcategory] = true;
}
}
}).done(function() { if (callback) { callback(); } });
});
databaseloaded = true;
console.log('Food database loaded');
fillForm();
maybePrevent(event);
if (callback) { callback(); }
};

boluscalc.loadFoodQuickpicks = function loadFoodQuickpicks( ) {
// Load quickpicks
$.ajax('/api/v1/food/quickpicks.json', {
headers: client.headers()
, success: function (records) {
quickpicks = records;
$('#bc_quickpick').empty().append('<option value="-1">' + translate('(none)') + '</option>');
for (var i=0; i<records.length; i++) {
var r = records[i];
$('#bc_quickpick').append('<option value="' + i +'">' + r.name + ' (' + r.carbs + ' g)</option>');
};
$('#bc_quickpick').val(-1);
$('#bc_quickpick').change(quickpickChange);
quickpicks = [];
var records = client.sbx.data.food || [];
records.forEach(function (r) {
if (r.type == 'quickpick') {
quickpicks.push(r);
}
});
$('#bc_quickpick').empty().append('<option value="-1">' + translate('(none)') + '</option>');
for (var i=0; i<records.length; i++) {
var r = records[i];
$('#bc_quickpick').append('<option value="' + i +'">' + r.name + ' (' + r.carbs + ' g)</option>');
};
$('#bc_quickpick').val(-1);
$('#bc_quickpick').change(quickpickChange);
};

function fillForm(event) {
Expand Down
12 changes: 9 additions & 3 deletions lib/client/chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,15 @@ function init (client, d3, $) {
var contextYDomain = [utils.scaleMgdl(36), utils.scaleMgdl(420)];

function dynamicDomain() {
var mult = 1.3
// allow y-axis to extend all the way to the top of the basal area, but leave room to display highest value
var mult = 1.15
, targetTop = client.settings.thresholds.bgTargetTop
, mgdlMax = d3.max(client.entries, function (d) { return d.mgdl; });
// filter to only use actual SGV's (not rawbg's) to set the view window.
// can switch to Logarithmic (non-dynamic) to see anything that doesn't fit in the dynamicDomain
, mgdlMax = d3.max(client.entries, function (d) { if ( d.type === 'sgv') { return d.mgdl; } });
// use the 99th percentile instead of max to avoid rescaling for 1 flukey data point
// need to sort client.entries by mgdl first
//, mgdlMax = d3.quantile(client.entries, 0.99, function (d) { return d.mgdl; });

return [
utils.scaleMgdl(30)
Expand Down Expand Up @@ -505,7 +511,7 @@ function init (client, d3, $) {

var updateBrush = d3.select('.brush').transition();
updateBrush
.call(chart.brush.extent([new Date(dataRange[1].getTime() - client.foucusRangeMS), dataRange[1]]));
.call(chart.brush.extent([new Date(dataRange[1].getTime() - client.focusRangeMS), dataRange[1]]));
client.brushed(true);

renderer.addContextCircles();
Expand Down
14 changes: 7 additions & 7 deletions lib/client/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ client.load = function load(serverSettings, callback) {

client.hashauth.initAuthentication(client.afterAuth);

client.foucusRangeMS = times.hours(client.settings.focusHours).msecs;
client.focusRangeMS = times.hours(client.settings.focusHours).msecs;
$('.focus-range li[data-hours=' + client.settings.focusHours + ']').addClass('selected');
client.brushed = brushed;
client.formatTime = formatTime;
Expand Down Expand Up @@ -365,7 +365,7 @@ client.load = function load(serverSettings, callback) {
d3.select('.brush')
.transition()
.duration(UPDATE_TRANS_MS)
.call(chart.brush.extent([new Date(dataRange[1].getTime() - client.foucusRangeMS), dataRange[1]]));
.call(chart.brush.extent([new Date(dataRange[1].getTime() - client.focusRangeMS), dataRange[1]]));

if (!skipBrushing) {
brushed();
Expand All @@ -385,14 +385,14 @@ client.load = function load(serverSettings, callback) {
var brushExtent = chart.brush.extent();

// ensure that brush extent is fixed at 3.5 hours
if (brushExtent[1].getTime() - brushExtent[0].getTime() !== client.foucusRangeMS) {
if (brushExtent[1].getTime() - brushExtent[0].getTime() !== client.focusRangeMS) {
// ensure that brush updating is with the time range
if (brushExtent[0].getTime() + client.foucusRangeMS > client.dataExtent()[1].getTime()) {
brushExtent[0] = new Date(brushExtent[1].getTime() - client.foucusRangeMS);
if (brushExtent[0].getTime() + client.focusRangeMS > client.dataExtent()[1].getTime()) {
brushExtent[0] = new Date(brushExtent[1].getTime() - client.focusRangeMS);
d3.select('.brush')
.call(chart.brush.extent([brushExtent[0], brushExtent[1]]));
} else {
brushExtent[1] = new Date(brushExtent[0].getTime() + client.foucusRangeMS);
brushExtent[1] = new Date(brushExtent[0].getTime() + client.focusRangeMS);
d3.select('.brush')
.call(chart.brush.extent([brushExtent[0], brushExtent[1]]));
}
Expand Down Expand Up @@ -868,7 +868,7 @@ client.load = function load(serverSettings, callback) {
$('.focus-range li').removeClass('selected');
li.addClass('selected');
var hours = Number(li.data('hours'));
client.foucusRangeMS = times.hours(hours).msecs;
client.focusRangeMS = times.hours(hours).msecs;
Storages.localStorage.set('focusHours', hours);
refreshChart();
} else {
Expand Down
Loading

0 comments on commit 6f97c28

Please sign in to comment.