Skip to content

Commit

Permalink
Merge pull request #31 from nightscout/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
unsoluble authored Mar 5, 2019
2 parents 537b4a7 + d437b56 commit 09b0785
Show file tree
Hide file tree
Showing 18 changed files with 614 additions and 964 deletions.
54 changes: 31 additions & 23 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,32 @@
language: node_js
node_js:
- "10"
- "8"
os:
- osx
before_install:
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update; fi
# https://github.com/Homebrew/homebrew-core/issues/26358
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew unlink python; fi
# "brew install" can succeed but return 1 if it has "caveats".
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install mongodb || true; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew services start mongodb; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install docker || true; fi
sudo: required
dist: xenial

node_js-steps: &node_js-steps
language: node_js
before_install:
- if [[ `npm --version` != "6.4.1" ]]; then npm install -g npm@latest; npm --version; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update; fi
# https://github.com/Homebrew/homebrew-core/issues/26358
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew unlink python; fi
# "brew install" can succeed but return 1 if it has "caveats".
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install mongodb || true; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew services start mongodb; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install docker || true; fi
script: make travis
after_success:
- nvm version
- if [[ ! -z "$DOCKER_USER" ]]; then docker login -u ${DOCKER_USER} -p ${DOCKER_PASS} && git checkout -- . && git clean -fd . && make docker_release; fi
after_script: make report
services:
- mongodb
- docker
matrix:
fast_finish: true
services:
- mongodb
- docker
script: make travis
after_success:
- nvm version
- if [[ ! -z "$DOCKER_USER" ]]; then docker login -u ${DOCKER_USER} -p ${DOCKER_PASS} && git checkout -- . && git clean -fd . && make docker_release; fi
after_script: make report
allow_failures:
node_js: "node"
include:
- node_js: "8"
<<: *node_js-steps
- node_js: "10"
<<: *node_js-steps
- node_js: "node" # Latest Node is not supported, and recommend, but we'll test it to know incompatibility issues
<<: *node_js-steps
44 changes: 5 additions & 39 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,7 @@ If in doubt, format your code with `js-beautify --indent-size 2 --comma-first -

## Create a prototype

<<<<<<< HEAD
Fork cgm-remote-monitor and create a branch.
You can create a branch using `git checkout -b wip/add-my-widget`.
This creates a new branch called `wip/add-my-widget`. The `wip`
stands for work in progress and is a common prefix so that we know
what to expect when reviewing many branches.
=======
Fork cgm-remote-monitor and create a branch. You can create a branch using `git checkout -b wip/add-my-widget`. This creates a new branch called `wip/add-my-widget`. The `wip` stands for work in progress and is a common prefix so that when know what to expect when reviewing many branches.
>>>>>>> master

## Submit a pull request

Expand All @@ -95,8 +87,6 @@ This can be done by checking your code `git commit -avm 'my improvements are her
Now that the commits are available on github, you can click on the compare buttons on your fork to create a pull request. Make sure to select [Nightscout's `dev` branch](https://github.com/nightscout/cgm-remote-monitor/tree/dev).
We assume all new Pull Requests are at least smoke tested by the author and all code in the PR actually works.
<<<<<<< HEAD
Please include a description of what the features do and rationalize why the changes are needed.
If you add any new NPM module dependencies, you have to rationalize why there are needed - we prefer pull requests that reduce dependencies, not add them.
Expand All @@ -106,26 +96,13 @@ When adding new features that add confugration options, please ensure the `READM
## Bug fixing
If you've fixed a bug, please consider adding a unit test to the `/tests` folder that reproduces the original bug without the change.

Try to identify the root cause of the issue and fix the issue. Pull requests that simply add null checks to hide issues are unlikely to be accepted.

This can be done by committing your code `git commit -avm 'my
improvements are here'`, and pushing it to the branch you created on your own
fork. This will probably look something like
`git push -u origin wip/add-my-widget`.
=======

Please include a description of what the features do and rationalize why the changes are needed.

If you add any new NPM module dependencies, you have to rationalize why there are needed - we prefer pull requests that reduce dependencies, not add them.

When adding new features that add confugration options, please ensure the `README` document is amended with information on the new configuration.

## Bug fixing

If you've fixed a bug, please consider adding a unit test to the `/tests` folder that reproduces the original bug without the change.
Try to identify the root cause of the issue and fix the issue. Pull requests that simply add null checks to hide issues are unlikely to be accepted.
>>>>>>> master

Please include instructions how to test the changes.

Expand All @@ -137,25 +114,11 @@ We encourage liberal use of the comments, including images where appropriate.

Most cgm-remote-monitor hackers use github's ticketing system, along with Facebook cgm-in-the-cloud, and gitter.
<<<<<<< HEAD
We use [git-flow](https://www.atlassian.com/git/tutorials/comparing-workflows/gitflow-workflow), with `master` as our production, stable branch, and
`dev` is used to queue changes for upcoming releases. Everything else is
done on branches, hopefully with names that indicate what to expect.

Once `dev` has been reviewed and people feel it's time to release, we
follow the git-flow release process, which creates a new tag and bumps
the version correctly. See [sem-ver](https://semver.org/) for versioning strategy.
Every commit is tested by Travis CI. We encourage adding tests to
validate your design. We encourage discussing your use cases to help
everyone get a better understanding of your design.
=======
We use git-flow, with `master` as our production, stable branch, and `dev` is used to queue up for upcoming releases. Everything else is done on branches, hopefully with names that indicate what to expect.
Once `dev` has been reviewed and people feel it's time to release, we follow the git-flow release process, which creates a new tag and bumps the version correctly. See sem-ver for versioning strategy.

Every commit is tested by travis. We encourage adding tests to validate your design. We encourage discussing your use cases to help everyone get a better understanding of your design.
>>>>>>> master

## Other Dev Tips

Expand All @@ -177,8 +140,10 @@ Also if you can't code, it's possible to contribute by improving the documentati
[@apanasef]: https://github.com/apanasef
[@bewest]: https://github.com/bewest
[@danamlewis]: https://github.com/danamlewis
[@diabetlum]: https://github.com/diabetlum
[@herzogmedia]: https://github.com/herzogmedia
[@jamieowendexcom ]: https://github.com/jamieowendexcom
[@janrpn]: https://github.com/janrpn
[@jasoncalabrese]: https://github.com/jasoncalabrese
[@jizhongwen]: https://github.com/jizhongwen
[@jpcunningh]: https://github.com/jpcunningh
Expand Down Expand Up @@ -255,7 +220,7 @@ Languages with less than 90% coverage will be removed in a future Nightscout ver
| Български (`bg`) |Please volunteer| OK |
| Čeština (`cs`) |Please volunteer|OK |
| Deutsch (`de`) |[@viderehh] [@herzogmedia] |OK |
| Dansk (`dk`) |Please volunteer|OK |
| Dansk (`dk`) | [@janrpn] |OK |
| Ελληνικά `(el`)|Please volunteer|Needs attention: 68.5%|
| English (`en`)|Please volunteer|OK|
| Español (`es`) |Please volunteer|OK|
Expand All @@ -274,6 +239,7 @@ Languages with less than 90% coverage will be removed in a future Nightscout ver
| Русский (`ru`)|[@apanasef]|OK|
| Slovenčina (`sk`)|Please volunteer|OK|
| Svenska (`sv`)|Please volunteer|OK|
| Türkçe (`tr`)|[@diabetlum]|OK|
| 中文(简体) (`zh_cn`) | [@jizhongwen]|OK|
| 中文(繁體) (`zh_tw`) | [@jizhongwen]|Needs attention: 25.0%
| 日本語 (`ja_jp`) | [@LuminaryXion]|
Expand Down
10 changes: 5 additions & 5 deletions Dockerfile.example
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
FROM node:8.9.1
FROM node:10-alpine

MAINTAINER Nightscout Contributors

RUN apt-get update && \
apt-get -y dist-upgrade

RUN mkdir -p /opt/app
ADD . /opt/app
WORKDIR /opt/app
RUN chown -R node:node /opt/app
USER node

RUN npm install && \
npm run postinstall && \
npm run env
npm run env && \
npm audit fix

EXPOSE 1337

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ Minimum browser requirements for viewing the site:

Windows installation software requirements:

- [Node.js](http://nodejs.org/) Latest Node 8 LTS (Node 8.15.0 or later) or Node 10 LTS (Node 10.15.1 or later; Node 10.14.1 works for Azure). Use [Install instructions for Node](https://nodejs.org/en/download/package-manager/) or use `setup.sh`)
- [Node.js](http://nodejs.org/) Latest Node 8 LTS (Node 8.15.1 or later) or Node 10 LTS (Node 10.15.2 or later; Node 10.14.1 works for Azure). Use [Install instructions for Node](https://nodejs.org/en/download/package-manager/) or use `setup.sh`)
- [MongoDB](https://www.mongodb.com/download-center?jmp=nav#community) 3.x or later. MongoDB 2.4 is only supported for Raspberry Pi.

As a non-root user clone this repo then install dependencies into the root of the project:
Expand Down
12 changes: 11 additions & 1 deletion lib/client/careportal.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function init (client, $) {
var inputMatrix = {};

_.forEach(careportal.allEventTypes, function each (event) {
inputMatrix[event.val] = _.pick(event, ['bg', 'insulin', 'carbs', 'prebolus', 'duration', 'percent', 'absolute', 'profile', 'split', 'reasons', 'targets']);
inputMatrix[event.val] = _.pick(event, ['bg', 'insulin', 'carbs', 'protein', 'fat', 'prebolus', 'duration', 'percent', 'absolute', 'profile', 'split', 'reasons', 'targets']);
});

careportal.filterInputs = function filterInputs ( event ) {
Expand All @@ -73,6 +73,8 @@ function init (client, $) {
$('#bg').css('display',displayType(inputMatrix[eventType]['bg']));
$('#insulinGivenLabel').css('display',displayType(inputMatrix[eventType]['insulin']));
$('#carbsGivenLabel').css('display',displayType(inputMatrix[eventType]['carbs']));
$('#proteinGivenLabel').css('display',displayType(inputMatrix[eventType]['protein']));
$('#fatGivenLabel').css('display',displayType(inputMatrix[eventType]['fat']));
$('#durationLabel').css('display',displayType(inputMatrix[eventType]['duration']));
$('#percentLabel').css('display',displayType(inputMatrix[eventType]['percent'] && $('#absolute').val() === ''));
$('#absoluteLabel').css('display',displayType(inputMatrix[eventType]['absolute'] && $('#percent').val() === ''));
Expand All @@ -89,6 +91,8 @@ function init (client, $) {

resetIfHidden(inputMatrix[eventType]['insulin'], '#insulinGiven');
resetIfHidden(inputMatrix[eventType]['carbs'], '#carbsGiven');
resetIfHidden(inputMatrix[eventType]['protein'], '#proteinGiven');
resetIfHidden(inputMatrix[eventType]['fat'], '#fatGiven');
resetIfHidden(inputMatrix[eventType]['duration'], '#duration');
resetIfHidden(inputMatrix[eventType]['absolute'], '#absolute');
resetIfHidden(inputMatrix[eventType]['percent'], '#percent');
Expand Down Expand Up @@ -177,6 +181,8 @@ function init (client, $) {
$('#glucoseValue').val('').attr('placeholder', translate('Value in') + ' ' + client.settings.units);
$('#meter').prop('checked', true);
$('#carbsGiven').val('');
$('#proteinGiven').val('');
$('#fatGiven').val('');
$('#insulinGiven').val('');
$('#duration').val('');
$('#percent').val('');
Expand All @@ -199,6 +205,8 @@ function init (client, $) {
, targetBottom: $('#targetBottom').val().replace(',','.')
, glucoseType: $('#treatment-form').find('input[name=glucoseType]:checked').val()
, carbs: $('#carbsGiven').val()
, protein: $('#proteinGiven').val()
, fat: $('#fatGiven').val()
, insulin: $('#insulinGiven').val()
, duration: times.msecs(parse_duration($('#duration').val())).mins < 1 ? $('#duration').val() : times.msecs(parse_duration($('#duration').val())).mins
, percent: $('#percent').val()
Expand Down Expand Up @@ -283,6 +291,8 @@ function init (client, $) {
pushIf(data.targetBottom, translate('Target Bottom') + ': ' + targetBottom);

pushIf(data.carbs, translate('Carbs Given') + ': ' + data.carbs);
pushIf(data.protein, translate('Protein Given') + ': ' + data.protein);
pushIf(data.fat, translate('Fat Given') + ': ' + data.fat);
pushIf(data.insulin, translate('Insulin Given') + ': ' + data.insulin);
pushIf(data.eventType === 'Combo Bolus', translate('Combo Bolus') + ': ' + data.splitNow + '% : ' + data.splitExt + '%');
pushIf(data.duration, translate('Duration') + ': ' + data.duration + ' ' + translate('mins'));
Expand Down
8 changes: 8 additions & 0 deletions lib/client/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1046,6 +1046,14 @@ client.load = function load(serverSettings, callback) {
});

$('#testAlarms').click(function(event) {

// Speech synthesis also requires on iOS that user triggers a speech event for it to speak anything
if (client.plugins('speech').isEnabled) {
var msg = new SpeechSynthesisUtterance('Ok ok.');
msg.lang = 'en-US';
window.speechSynthesis.speak(msg);
}

d3.selectAll('.audio.alarms audio').each(function () {
var audio = this;
playAlarm(audio);
Expand Down
10 changes: 10 additions & 0 deletions lib/client/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,14 @@ function init (client, d3) {
arc_data[1].element = Math.round(treatment.carbs) + ' g';
}

if (treatment.protein > 0) {
arc_data[1].element = arc_data[1].element + " / " + Math.round(treatment.protein) + ' g';
}

if (treatment.fat > 0) {
arc_data[1].element = arc_data[1].element + " / " + Math.round(treatment.fat) + ' g';
}

if (treatment.foodType) {
arc_data[1].element = arc_data[1].element + " " + treatment.foodType;
}
Expand Down Expand Up @@ -513,6 +521,8 @@ function init (client, d3) {
client.tooltip.transition().duration(TOOLTIP_TRANS_MS).style('opacity', .9);
client.tooltip.html('<strong>' + translate('Time') + ':</strong> ' + client.formatTime(new Date(treatment.mills)) + '<br/>' + '<strong>' + translate('Treatment type') + ':</strong> ' + translate(client.careportal.resolveEventName(treatment.eventType)) + '<br/>' +
(treatment.carbs ? '<strong>' + translate('Carbs') + ':</strong> ' + treatment.carbs + '<br/>' : '') +
(treatment.protein ? '<strong>' + translate('Protein') + ':</strong> ' + treatment.protein + '<br/>' : '') +
(treatment.fat ? '<strong>' + translate('Fat') + ':</strong> ' + treatment.fat + '<br/>' : '') +
(treatment.absorptionTime > 0 ? '<strong>' + translate('Absorption Time') + ':</strong> ' + (Math.round( treatment.absorptionTime / 60.0 * 10) / 10) + 'h' + '<br/>' : '') +
(treatment.insulin ? '<strong>' + translate('Insulin') + ':</strong> ' + treatment.insulin + '<br/>' : '') +
(treatment.enteredinsulin ? '<strong>' + translate('Combo Bolus') + ':</strong> ' + treatment.enteredinsulin + 'U, ' + treatment.splitNow + '% : ' + treatment.splitExt + '%, ' + translate('Duration') + ': ' + treatment.duration + '<br/>' : '') +
Expand Down
Loading

0 comments on commit 09b0785

Please sign in to comment.