Skip to content

Commit

Permalink
Merge pull request #9 from nightscout/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
winni67 authored Dec 19, 2017
2 parents 40d0db3 + 18892a4 commit aff5f27
Show file tree
Hide file tree
Showing 19 changed files with 1,685 additions and 305 deletions.
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8.9.0
8.9.1
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ language: node_js
sudo: required
dist: trusty
node_js:
- "8.9.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.9.0
FROM node:8.9.1

MAINTAINER Nightscout Contributors

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.2-release-20171103",
"version": "0.10.3-dev-20171205"",
"dependencies": {
"colorbrewer": "~1.0.0",
"jQuery-Storage-API": "~1.7.2",
Expand Down
27 changes: 21 additions & 6 deletions lib/client/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -444,13 +444,18 @@ function init (client, d3) {
}

if ( treatment.insulin > 0) {
var dosage_units = Math.round(treatment.insulin * 100)/100;
var dosage_units = '' + Math.round(treatment.insulin * 100)/100;

var unit_of_measurement = ' U'; // One international unit of insulin (1 IU) is shown as '1 U'
if ( treatment.insulin < 1 && !treatment.carbs ) { // don't show the unit of measurement for insulin boluses < 1 without carbs (e.g. oref0 SMB's). Otherwise lot's of small insulin only dosages are often unreadable
var enteredBy = '' + treatment.enteredBy;

if ( treatment.insulin < 1 && !treatment.carbs && enteredBy.indexOf('openaps') > -1) { // don't show the unit of measurement for insulin boluses < 1 without carbs (e.g. oref0 SMB's). Otherwise lot's of small insulin only dosages are often unreadable
unit_of_measurement = '';
// remove leading zeros to avoid overlap with adjacent boluses
dosage_units = (dosage_units+"").replace(/^0/,"");
}
// remove leading zeros to avoid overlap with adjacent boluses
arc_data[3].element = (dosage_units+"").replace(/^0/,"")+unit_of_measurement;

arc_data[3].element = dosage_units + unit_of_measurement;
}

if (treatment.status) {
Expand Down Expand Up @@ -855,10 +860,12 @@ function init (client, d3) {
.attr('class', 'path')
.attr('id', 'label')
.style('fill', 'white');

// reduce the treatment label font size to make it readable with SMB
var fontBaseSize = (opts.treatments >= 30) ? 40 : 50 - Math.floor((25-opts.treatments)/30 * 10);

label.append('text')
// reduce the treatment label font size to make it readable with SMB
.style('font-size', 30 / opts.scale)
.style('font-size', fontBaseSize / opts.scale)
.style('text-shadow', '0px 0px 10px rgba(0, 0, 0, 1)')
.attr('text-anchor', 'middle')
.attr('dy', '.35em')
Expand All @@ -874,11 +881,19 @@ function init (client, d3) {
}

renderer.drawTreatments = function drawTreatments(client) {

var treatmentCount = 0;

_.forEach(client.ddata.treatments, function eachTreatment (d) {
if (Number(d.insulin) > 0 || Number(d.carbs) > 0) { treatmentCount += 1; };
});

// add treatment bubbles
_.forEach(client.ddata.treatments, function eachTreatment (d) {
renderer.drawTreatment(d, {
scale: renderer.bubbleScale()
, showLabels: true
, treatments: treatmentCount
}, client.sbx.data.profile.getCarbRatio(new Date()));
});
};
Expand Down
Loading

0 comments on commit aff5f27

Please sign in to comment.