Skip to content

Commit b8bc46e

Browse files
author
Jason Calabrese
committed
Merge branch 'release/0.4.2'
2 parents 1728cdd + 22678fd commit b8bc46e

File tree

5 files changed

+44
-30
lines changed

5 files changed

+44
-30
lines changed

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "nightscout",
3-
"version": "0.4.0",
3+
"version": "0.4.2",
44
"dependencies": {
55
"angularjs": "1.3.0-beta.19",
66
"bootstrap": "~3.2.0",

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "Nightscout",
3-
"version": "0.4.1",
3+
"version": "0.4.2",
44
"description": "Nightscout acts as a web-based CGM (Continuous Glucose Montinor) to allow multiple caregivers to remotely view a patients glucose data in realtime.",
55
"license": "MIT",
66
"author": "Nightscout Team",

static/css/drawer.css

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
color: #eee;
66
display: none;
77
font-size: 16px;
8-
height: calc(100% - 45px);
8+
height: 100%;
99
overflow-y: auto;
1010
position: absolute;
1111
margin-top: 45px;
@@ -25,7 +25,7 @@
2525
color: #eee;
2626
display: none;
2727
font-size: 16px;
28-
height: calc(100% - 45px);
28+
height: 100%;
2929
overflow-y: auto;
3030
position: absolute;
3131
margin-top: 45px;
@@ -144,21 +144,20 @@ h1, legend,
144144
margin-top: 0;
145145
margin-left: 42px;
146146
padding-top: 10px;
147+
padding-right: 150px;
148+
white-space: nowrap;
149+
text-overflow: ellipsis;
150+
overflow: hidden;
147151
}
148152
#buttonbar {
149153
padding-right: 10px;
150-
float: right;
151154
height: 44px;
152155
opacity: 0.75;
153156
vertical-align: middle;
154-
width: 20ex;
155-
}
156-
#buttonbar div {
157-
border-radius: 5px;
158-
float: left;
159-
height: 44px;
160-
width: 44px;
157+
position: absolute;
158+
right: 0;
161159
}
160+
162161
#buttonbar a,
163162
#buttonbar i {
164163
color: #ccc;

static/index.html

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,14 @@
66
<link rel="apple-touch-icon" href="/images/logomobile.png">
77
<title>NightScout</title>
88
<link href="/images/round1.png" rel="icon" id="favicon" type="image/png" />
9-
<link rel="stylesheet" type="text/css" href="/css/main.css?v=0.4.0" />
9+
<link rel="stylesheet" type="text/css" href="/css/main.css?v=0.4.2" />
1010
<link rel="stylesheet" type="text/css" href="/css/dropdown.css" />
11-
<link rel="stylesheet" type="text/css" href="/css/drawer.css?v=0.4.0" />
11+
<link rel="stylesheet" type="text/css" href="/css/drawer.css?v=0.4.2b" />
1212
<link rel="stylesheet" type="text/css" href="/bower_components/tipsy-jmalonzo/src/stylesheets/tipsy.css" />
1313
</head>
1414
<body>
1515
<div id="toolbar">
1616
<div id="buttonbar">
17-
<div style="visibility:hidden" id="battery" class="tip" original-title="Uploader Battery 75%"><i class="icon-battery-75"></i></div>
1817
<a id="testAlarms" class="tip" original-title="Alarm Test / Smartphone Enable" href="#"><i class="icon-volume"></i></a>
1918
<a id="hideToolbar" class="tip" original-title="Hides the toolbar" href="#"><i class="icon-angle-double-up"></i></a>
2019
<a id="drawerToggle" class="tip" original-title="Settings" href="#"><i class="icon-cog"></i></a>
@@ -180,8 +179,8 @@ <h1 class="customTitle">Nightscout</h1>
180179
<script src="/bower_components/jquery/dist/jquery.min.js"></script>
181180
<script src="/bower_components/jQuery-Storage-API/jquery.storageapi.min.js"></script>
182181
<script src="/bower_components/tipsy-jmalonzo/src/javascripts/jquery.tipsy.js"></script>
183-
<script src="/js/ui-utils.js?v=0.4.0"></script>
184-
<script src="/js/client.js?v=0.4.0"></script>
182+
<script src="/js/ui-utils.js?v=0.4.2"></script>
183+
<script src="/js/client.js?v=0.4.2"></script>
185184
<script src="/js/experiments.js"></script>
186185
</body>
187186
</html>

static/js/client.js

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -232,15 +232,22 @@
232232
var nowData = data.filter(function(d) {
233233
return d.date.getTime() >= brushExtent[1].getTime() - FORTY_TWO_MINS_IN_MS &&
234234
d.date.getTime() <= brushExtent[1].getTime() - TWENTY_FIVE_MINS_IN_MS &&
235-
d.color != 'none';
235+
d.type == 'sgv';
236236
});
237237
if (nowData.length > 1) {
238238
var prediction = predictAR(nowData);
239239
focusData = focusData.concat(prediction);
240240
var focusPoint = nowData[nowData.length - 1];
241-
$('.container .currentBG')
242-
.text(focusPoint.sgv)
243-
.css('text-decoration','line-through');
241+
242+
//in this case the SGV is scaled
243+
if (focusPoint.sgv < scaleBg(40))
244+
$('.container .currentBG').text('LOW');
245+
else if (focusPoint.sgv > scaleBg(400))
246+
$('.container .currentBG').text('HIGH');
247+
else
248+
$('.container .currentBG').text(focusPoint.sgv);
249+
250+
$('.container .currentBG').css('text-decoration','line-through');
244251
$('.container .currentDirection')
245252
.html(focusPoint.direction)
246253
} else {
@@ -260,7 +267,7 @@
260267
} else {
261268
// if the brush comes back into the current time range then it should reset to the current time and sg
262269
var nowData = data.filter(function(d) {
263-
return d.color != 'none' && d.color != 'red';
270+
return d.type == 'sgv';
264271
});
265272
nowData = [nowData[nowData.length - 2], nowData[nowData.length - 1]];
266273
var prediction = predictAR(nowData);
@@ -304,9 +311,15 @@
304311
var secsSinceLast = (Date.now() - new Date(latestSGV.x).getTime()) / 1000;
305312
$('#lastEntry').text(timeAgo(secsSinceLast)).toggleClass('current', secsSinceLast < 10 * 60);
306313

307-
$('.container .currentBG')
308-
.text(scaleBg(latestSGV.y))
309-
.css('text-decoration', '');
314+
//in this case the SGV is unscaled
315+
if (latestSGV.y < 40)
316+
$('.container .currentBG').text('LOW');
317+
else if (latestSGV.y > 400)
318+
$('.container .currentBG').text('HIGH');
319+
else
320+
$('.container .currentBG').text(scaleBg(latestSGV.y));
321+
322+
$('.container .currentBG').css('text-decoration', '');
310323
$('.container .currentDirection')
311324
.html(latestSGV.direction);
312325

@@ -336,7 +349,7 @@
336349
.attr('cy', function (d) { return yScale(d.sgv); })
337350
.attr('fill', function (d) { return d.color; })
338351
.attr('opacity', function (d) { return futureOpacity(d.date - latestSGV.x); })
339-
.attr('r', 3);
352+
.attr('r', function(d) { if (d.type == 'mbg') return 6; else return 3;});
340353

341354
focusCircles.exit()
342355
.remove();
@@ -731,7 +744,7 @@
731744
.attr('cy', function (d) { return yScale2(d.sgv); })
732745
.attr('fill', function (d) { return d.color; })
733746
.style('opacity', function (d) { return highlightBrushPoints(d) })
734-
.attr('r', 2);
747+
.attr('r', function(d) { if (d.type == 'mbg') return 4; else return 2;});
735748

736749
contextCircles.exit()
737750
.remove();
@@ -800,15 +813,17 @@
800813
}
801814
}
802815
data = d[0].map(function (obj) {
803-
return { date: new Date(obj.x), y: obj.y, sgv: scaleBg(obj.y), direction: obj.direction, color: sgvToColor(obj.y)}
816+
return { date: new Date(obj.x), y: obj.y, sgv: scaleBg(obj.y), direction: obj.direction, color: sgvToColor(obj.y), type: 'sgv'}
804817
});
805818
// TODO: This is a kludge to advance the time as data becomes stale by making old predictor clear (using color = 'none')
806819
// This shouldn't have to be sent and can be fixed by using xScale.domain([x0,x1]) function with
807820
// 2 days before now as x0 and 30 minutes from now for x1 for context plot, but this will be
808821
// required to happen when "now" event is sent from websocket.js every minute. When fixed,
809822
// remove all "color != 'none'" code
810-
data = data.concat(d[1].map(function (obj) { return { date: new Date(obj.x), y: obj.y, sgv: scaleBg(obj.y), color: 'none'} }));
811-
data = data.concat(d[2].map(function (obj) { return { date: new Date(obj.x), y: obj.y, sgv: scaleBg(obj.y), color: 'red'} }));
823+
data = data.concat(d[1].map(function (obj) { return { date: new Date(obj.x), y: obj.y, sgv: scaleBg(obj.y), color: 'none', type: 'server-forecast'} }));
824+
825+
//Add MBG's also, pretend they are SGV's
826+
data = data.concat(d[2].map(function (obj) { return { date: new Date(obj.x), y: obj.y, sgv: scaleBg(obj.y), color: 'red', type: 'mbg'} }));
812827

813828
data.forEach(function (d) {
814829
if (d.y < 39)
@@ -1092,6 +1107,7 @@
10921107
color: predictedColor
10931108
};
10941109
predicted.forEach(function (d) {
1110+
d.type = 'forecast';
10951111
if (d.sgv < BG_MIN)
10961112
d.color = "transparent";
10971113
})

0 commit comments

Comments
 (0)