Skip to content

Commit

Permalink
Merge pull request #2 from ELUTE/wip/bgDel
Browse files Browse the repository at this point in the history
Delta below BG, better MMOL support
  • Loading branch information
jimsiff committed Nov 16, 2014
2 parents 6873e6d + cae1972 commit 5e2f887
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 7 deletions.
6 changes: 6 additions & 0 deletions static/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,19 @@ body {
.bgStatus .currentDelta {
font-size: 35%;
text-decoration: line-through;
display: block;
position: relative;
top: -20px;
}
.bgStatus.current .currentBG {
text-decoration: none;
}
.bgStatus.current .currentDelta {
font-size: 35%;
text-decoration: none;
display: block;
position: relative;
top: -20px;
}
.currentDirection {
font-weight: normal;
Expand Down
5 changes: 3 additions & 2 deletions static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,14 @@ <h1 class="customTitle">Nightscout</h1>
<div class="bgStatus current">
<div id="noButton">
<span class="currentBG">---</span>
<span class="currentDelta">--</span>
<span class="currentDirection">-</span>
<span class="currentDelta">--</span>

</div>
<div id="bgButton" hidden="true">
<span class="currentBG">---</span>
<span class="currentDelta">--</span>
<span class="currentDirection">-</span>
<span class="currentDelta">--</span>
</div>
<ul class="dropdown-menu" id="silenceBtn">
<li><a href="#" data-snooze-time="1800000">Silence for 30 minutes</a></li>
Expand Down
29 changes: 24 additions & 5 deletions static/js/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@
return bg;
}
}

// initial setup of chart when data is first made available
function initializeCharts() {

Expand Down Expand Up @@ -298,7 +297,12 @@
$('.container .currentBG').text('HIGH');
else
$('.container .currentBG').text(focusPoint.sgv);


var retroDelta = scaleBg(focusPoint.y) - scaleBg(prevfocusPoint.y);
if (browserSettings.units == "mmol") {
retroDelta = retroDelta.toFixed(1);
}
if (retroDelta < 0) {
var retroDeltaString = retroDelta;
}
Expand All @@ -308,12 +312,18 @@
else {
var retroDeltaString = "+/-0";
}

if (browserSettings.units == "mmol") {
var retroDeltaString = retroDeltaString + " mmol/L"
}
else {
var retroDeltaString = retroDeltaString + " mg/dL"
}
$('.container .currentDelta').text(retroDeltaString);

$('.container .currentBG').css('text-decoration','line-through');
$('.container .currentDirection').html(focusPoint.direction)
$('.container .currentDelta').css('text-decoration','line-through');
$('.container .currentDirection')
.html(focusPoint.direction)
} else {
$('.container .currentBG')
.text("---")
Expand Down Expand Up @@ -385,6 +395,10 @@
else
$('.container .currentBG').text(scaleBg(latestSGV.y));
var bgDelta = scaleBg(latestSGV.y) - scaleBg(prevSGV.y);
if (browserSettings.units == "mmol") {
bgDelta = bgDelta.toFixed(1);
}

if (bgDelta < 0) {
var bgDeltaString = bgDelta;
}
Expand All @@ -394,12 +408,17 @@
else {
var bgDeltaString = "+/-0";
}
if (browserSettings.units == "mmol") {
var bgDeltaString = bgDeltaString + " mmol/L"
}
else {
var bgDeltaString = bgDeltaString + " mg/dL"
}
$('.container .currentDelta').text(bgDeltaString);

$('.container .currentBG').css('text-decoration', '');
$('.container .currentDirection').html(latestSGV.direction);
$('.container .currentDelta').css('text-decoration','');
$('.container .currentDirection')
.html(latestSGV.direction);

var color = sgvToColor(latestSGV.y);
$('.container #noButton .currentBG').css({color: color});
Expand Down

0 comments on commit 5e2f887

Please sign in to comment.