Skip to content

Commit

Permalink
Merge pull request #15 from nightscout/master
Browse files Browse the repository at this point in the history
update my site
  • Loading branch information
wagnerpe committed Sep 14, 2014
2 parents bbe3d50 + 1728cdd commit ca54da0
Show file tree
Hide file tree
Showing 13 changed files with 96 additions and 10 deletions.
15 changes: 15 additions & 0 deletions Release.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

v0.4.1 / 2014-09-12
==================

* quick hack to prevent mbg records from crashing pebble
* add script to prep release branch
* tweak toolbar and button size/placement
* Merge pull request #128 from nightscout/wip/mbg
* Merge pull request #166 from nightscout/wip/id-rev
* Merge pull request #165 from nightscout/hotfix/pebble-sgv-string
* convert sgv to string
* add ability to easily id git rev-parse HEAD
* Merge branch 'release/0.4.0' into dev
* hack: only consider 'grey' sgv records
* Added searching for MBG data from mongo query.
8 changes: 8 additions & 0 deletions env.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,15 @@ function config ( ) {
* directory.
*/
var software = require('./package.json');
var git = require('git-rev');

if (readENV('SCM_GIT_EMAIL') == 'windowsazure' && readENV('ScmType') == 'GitHub') {
git.cwd('/home/site/repository');
}
git.short(function record_git_head (head) {
console.log("GIT HEAD", head);
env.head = head;
});
env.version = software.version;
env.name = software.name;

Expand Down
5 changes: 5 additions & 0 deletions lib/api/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ function create (env, entries, settings, treatments, devicestatus) {
// set up express app with our options
app.set('name', env.name);
app.set('version', env.version);
// app.set('head', env.head);
function get_head ( ) {
return env.head;
}
wares.get_head = get_head;
app.set('units', env.DISPLAY_UNITS);
// Only allow access to the API if API_SECRET is set on the server.
app.disable('api');
Expand Down
1 change: 1 addition & 0 deletions lib/api/status.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ function configure (app, wares) {
, apiEnabled: app.enabled('api')
, careportalEnabled: app.enabled('api') && app.enabled('careportal')
, units: app.get('units')
, head: wares.get_head( )
, version: app.get('version')
, name: app.get('name')};
var badge = 'http://img.shields.io/badge/Nightscout-OK-green';
Expand Down
1 change: 1 addition & 0 deletions lib/pebble.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ function pebble (req, res) {
}
if (element) {
var obj = {};
if (!element.sgv) return;
obj.sgv = scaleBg(element.sgv).toString( );
obj.bgdelta = (next ? (scaleBg(element.sgv) - scaleBg(next.sgv) ) : 0);
if (useMetricBg) {
Expand Down
31 changes: 24 additions & 7 deletions lib/websocket.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ var dir2Char = {

var cgmData = [],
treatmentData = [],
mbgData = [],
patientData = [];

function start ( ) {
Expand Down Expand Up @@ -104,17 +105,26 @@ function update() {

cgmData = [];
treatmentData = [];
mbgData = [];
var earliest_data = now - TWO_DAYS;
var q = { find: {"date": {"$gte": earliest_data}} };
entries.list(q, function (err, results) {
results.forEach(function(element, index, array) {
if (element) {
var obj = {};
obj.y = element.sgv;
obj.x = element.date;
obj.d = element.dateString;
obj.direction = directionToChar(element.direction);
cgmData.push(obj);
if (element.mbg) {
var obj = {};
obj.y = element.mbg;
obj.x = element.date;
obj.d = element.dateString;
mbgData.push(obj);
} else if (element.sgv) {
var obj = {};
obj.y = element.sgv;
obj.x = element.date;
obj.d = element.dateString;
obj.direction = directionToChar(element.direction);
cgmData.push(obj);
}
}
});
treatments.list(function (err, results) {
Expand Down Expand Up @@ -143,11 +153,11 @@ function emitAlarm(alarmType) {
function loadData() {

console.log('running loadData');
var mbg = [];

var actual = [],
actualCurrent,
treatment = [],
mbg = [],
errorCode;

if (cgmData) {
Expand All @@ -172,6 +182,13 @@ function loadData() {
});
}

if (mbgData) {
mbg = mbgData.slice();
mbg.sort(function(a, b) {
return a.x - b.x;
});
}

if (actualCurrent && actualCurrent < 39) errorCode = actualCurrent;

var actualLength = actual.length - 1;
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Nightscout",
"version": "0.4.0",
"version": "0.4.1",
"description": "Nightscout acts as a web-based CGM (Continuous Glucose Montinor) to allow multiple caregivers to remotely view a patients glucose data in realtime.",
"license": "MIT",
"author": "Nightscout Team",
Expand Down Expand Up @@ -42,7 +42,8 @@
"moment": "2.8.1",
"pushover-notifications": "0.2.0",
"sgvdata": "0.0.2",
"socket.io": "^0.9.17"
"socket.io": "^0.9.17",
"git-rev": "git://github.com/bewest/git-rev.git"
},
"devDependencies": {
"supertest": "~0.13.0",
Expand Down
33 changes: 33 additions & 0 deletions prep_repo_release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash
set -ueE

function update ( ) {
upgrade=$1
npm version $upgrade || exit 255
}

RELEASE_NOTES="Release.md"
TYPE=${1-'patch'}
echo "First update"

npm ls . || echo -n ""
NEW_TAG=$(update ${TYPE})
echo "Updating to $NEW_TAG"
# npm commits a new package json on your behalf with a new tag pointed at it
git reset --hard HEAD~1
git tag -d $NEW_TAG || echo "warning ${NEW_TAG} not present"
BRANCH_NAME="release/${NEW_TAG}"
git checkout -b ${BRANCH_NAME}
npm ls . || echo -n ""
cat /dev/null > ${RELEASE_NOTES}
git changelog -t ${NEW_TAG} ${RELEASE_NOTES}
echo "saving release notes"
git add ${RELEASE_NOTES}
git commit -vm "Release notes for ${NEW_TAG}"

echo "Final update"
update ${TYPE}
echo "New version $NEW_TAG"
echo "Branch ${BRANCH_NAME}"
npm ls . || echo -n ""

1 change: 1 addition & 0 deletions static/css/drawer.css
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ h1, legend,
height: 44px;
opacity: 0.75;
vertical-align: middle;
width: 20ex;
}
#buttonbar div {
border-radius: 5px;
Expand Down
1 change: 1 addition & 0 deletions static/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ body {
font-family: 'Ubuntu', Helvetica, Arial, sans-serif;
height: 180px;
vertical-align: middle;
clear: both;
}

.bgStatus {
Expand Down
1 change: 1 addition & 0 deletions static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ <h1 class="customTitle">Nightscout</h1>
<legend>About</legend>
<div class="appName"></div>
<div>version <span class="version"></span></div>
<div>head <span class="head"></span></div>
<div class="links">
<a href="https://github.com/nightscout/cgm-remote-monitor/releases">Release Notes</a><br />
<a href="http://github.com/nightscout/cgm-remote-monitor">Open Source</a><br />
Expand Down
2 changes: 1 addition & 1 deletion static/js/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@
} else {
// if the brush comes back into the current time range then it should reset to the current time and sg
var nowData = data.filter(function(d) {
return d.color != 'none';
return d.color != 'none' && d.color != 'red';
});
nowData = [nowData[nowData.length - 2], nowData[nowData.length - 1]];
var prediction = predictAR(nowData);
Expand Down
2 changes: 2 additions & 0 deletions static/js/ui-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@ $.ajax("/api/v1/status.json", {
app = {
"name": xhr.name,
"version": xhr.version,
"head": xhr.head,
"apiEnabled": xhr.apiEnabled,
"careportalEnabled": xhr.careportalEnabled
}
}
}).done(function() {
$(".appName").text(app.name);
$(".version").text(app.version);
$(".head").text(app.head);
if (app.apiEnabled) {
$(".serverSettings").show();
}
Expand Down

0 comments on commit ca54da0

Please sign in to comment.