Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed error if latestSGV not filled #4919

Merged
merged 40 commits into from
Sep 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
6f8a295
(bluefox) add npmignore
GermanBluefox Jul 29, 2019
f81298f
Release 0.12.3
sulkaharo Jul 30, 2019
1ce3b0b
Make it runnable as npm package
GermanBluefox Jul 30, 2019
6727428
(bluefox) use absolute path for static folder
GermanBluefox Jul 31, 2019
94be928
Merge remote-tracking branch 'remotes/nightscout/master'
GermanBluefox Aug 3, 2019
5f222b7
Allow start not only from cgm-remote-monitor
GermanBluefox Aug 3, 2019
5afbdd4
(bluefox) add polling option to make it possible the communication wi…
GermanBluefox Aug 6, 2019
60b40d1
0.12.3-2
GermanBluefox Aug 6, 2019
8d06b40
(bluefox) fix errors
GermanBluefox Aug 6, 2019
409b6a5
(bluefox) fix clock with authentication
GermanBluefox Aug 6, 2019
0a2dcbe
(bluefox) fix clock
GermanBluefox Aug 6, 2019
b523419
Merge remote-tracking branch 'remotes/nightscout/dev'
GermanBluefox Aug 6, 2019
007cea4
fix time
GermanBluefox Aug 6, 2019
11aff8a
Formatting
GermanBluefox Aug 6, 2019
3c25914
Fix clock if authentication is enabled
GermanBluefox Aug 6, 2019
baa613f
Merge branch 'dev'
GermanBluefox Aug 6, 2019
366d10c
Add time to clock view back
GermanBluefox Aug 6, 2019
bb5fe99
Merge branch 'dev'
GermanBluefox Aug 6, 2019
3a52cac
Formatting
GermanBluefox Aug 6, 2019
ce21b4e
Merge branch 'dev'
GermanBluefox Aug 6, 2019
d2d82dd
Fix authentication dialog
GermanBluefox Aug 7, 2019
d61e8f9
Select browser language for authentication dialog
GermanBluefox Aug 7, 2019
7bb7289
Merge branch 'dev'
GermanBluefox Aug 7, 2019
050808d
Update hashauth.js
GermanBluefox Aug 7, 2019
ccad081
Update hashauth.js
GermanBluefox Aug 7, 2019
293ac55
Update hashauth.js
GermanBluefox Aug 7, 2019
afbe6a3
Update hashauth.js
GermanBluefox Aug 7, 2019
fa442ae
(bluefox) fix chart if no latestSGV defined
GermanBluefox Aug 10, 2019
d361a72
Select language from localStorage
GermanBluefox Aug 10, 2019
22474e2
Fix language selection
GermanBluefox Aug 10, 2019
bd42ad8
Merge branch 'dev' into dev
GermanBluefox Aug 23, 2019
db1febb
Charts were fixed if no latestSGV value found
GermanBluefox Aug 23, 2019
7f22ad4
Merge remote-tracking branch 'remotes/nightscout/dev' into dev
GermanBluefox Aug 23, 2019
2c935ee
Merge branch 'dev' of https://github.com/GermanBluefox/cgm-remote-mon…
GermanBluefox Aug 23, 2019
88c6d16
Merge branch 'dev'
GermanBluefox Aug 23, 2019
6baf359
Remove .npmignore
GermanBluefox Aug 23, 2019
beed799
Merge branch 'master' into dev
GermanBluefox Aug 23, 2019
f4e07fb
Some code formatting. No relevant changes
GermanBluefox Aug 23, 2019
18cd822
Show "-?-" in clock mode if no measured value found.
GermanBluefox Aug 23, 2019
a87fb50
Small CSS Formatting
GermanBluefox Aug 23, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion lib/client/clock-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,22 @@ client.render = function render (xhr) {
}
});

let $errorMessage = $('#errorMessage');

// If no one measured value found => show "-?-"
if (!rec) {
if (!$errorMessage.length) {
$('#arrowDiv').append('<div id="errorMessage" title="No data found in DB">-?-</div>');
$('#arrow').hide();
} else {
$errorMessage.show();
}
return;
} else {
$errorMessage.length && $errorMessage.hide();
$('#arrow').show();
}

let last = new Date(rec.date);
let now = new Date();

Expand Down Expand Up @@ -163,4 +179,4 @@ client.init = function init () {
setInterval(client.query, 1 * 60 * 1000);
};

module.exports = client;
module.exports = client;
5 changes: 2 additions & 3 deletions lib/client/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
'use strict';
'use strict';

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One 'use strict' too much

var _ = require('lodash');
var $ = (global && global.$) || require('jquery');
Expand Down Expand Up @@ -64,7 +63,7 @@ client.init = function init (callback) {
}).fail(function fail (jqXHR, textStatus, errorThrown) {

// check if we couldn't reach the server at all, show offline message
if (jqXHR.readyState == 0) {
if (!jqXHR.readyState) {
console.log('Application appears to be OFFLINE');
$('#loadingMessageText').html('Connecting to Nightscout server failed, retrying every 2 seconds');
window.setTimeout(window.Nightscout.client.init(), 2000);
Expand Down Expand Up @@ -1006,7 +1005,7 @@ client.load = function load (serverSettings, callback) {
socket.on('notification', function(notify) {
console.log('notification from server:', notify);

if (notify.timestamp && previousNotifyTimestamp != notify.timestamp) {
if (notify.timestamp && previousNotifyTimestamp !== notify.timestamp) {
previousNotifyTimestamp = notify.timestamp;
client.plugins.visualizeAlarm(client.sbx, notify, notify.title + ' ' + notify.message);
} else {
Expand Down
12 changes: 6 additions & 6 deletions lib/client/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ function init (client, d3) {

// get the desired opacity for context chart based on the brush extent
renderer.highlightBrushPoints = function highlightBrushPoints (data) {
if (data.mills >= chart().brush.extent()[0].getTime() && data.mills <= chart().brush.extent()[1].getTime()) {
if (client.latestSGV && data.mills >= chart().brush.extent()[0].getTime() && data.mills <= chart().brush.extent()[1].getTime()) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At the very first start there is no measured values and the user can see errors in console.

return chart().futureOpacity(data.mills - client.latestSGV.mills);
} else {
return 0.5;
Expand Down Expand Up @@ -111,7 +111,7 @@ function init (client, d3) {
return d.type === 'forecast' ? 'none' : d.color;
})
.attr('opacity', function(d) {
return d.noFade ? 100 : chart().futureOpacity(d.mills - client.latestSGV.mills);
return d.noFade || !client.latestSGV ? 100 : chart().futureOpacity(d.mills - client.latestSGV.mills);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At the very first start there is no measured values and the user can see errors in console.

})
.attr('stroke-width', function(d) {
return d.type === 'mbg' ? 2 : d.type === 'forecast' ? 2 : 0;
Expand Down Expand Up @@ -897,7 +897,7 @@ function init (client, d3) {
, treatments: treatmentCount
}, client.sbx.data.profile.getCarbRatio(new Date()));
});
}
};

renderer.drawTreatment = function drawTreatment (treatment, opts, carbratio) {
if (!treatment.carbs && !treatment.insulin) {
Expand All @@ -920,7 +920,7 @@ function init (client, d3) {
var arc = prepareArc(treatment, radius);
var treatmentDots = appendTreatments(treatment, arc);
appendLabels(treatmentDots, arc, opts);
}
};

renderer.addBasals = function addBasals (client) {

Expand Down Expand Up @@ -1009,15 +1009,15 @@ function init (client, d3) {
.attr('stroke', '#0099ff')
.attr('stroke-width', 1)
.attr('fill', 'none')
.attr('d', valueline(linedata))
.attr('d', valueline(linedata));

g.append('path')
.attr('class', 'line notempline')
.attr('stroke', '#0099ff')
.attr('stroke-width', 1)
.attr('stroke-dasharray', ('3, 3'))
.attr('fill', 'none')
.attr('d', valueline(notemplinedata))
.attr('d', valueline(notemplinedata));

g.append('path')
.attr('class', 'area basalarea')
Expand Down
9 changes: 5 additions & 4 deletions lib/report_plugins/daytoday.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,11 @@ daytoday.report = function report_daytoday (datastorage, sorteddaystoshow, optio
var fatAverage = fatSum / datastorage.alldays;

if (options.insulindistribution)
$('#daytodaycharts').append('<br><br><b>' + translate('TDD average') + ':</b> ' + tddAverage.toFixed(1) + 'U <b>' +
translate('Carbs average') + ':</b> ' + carbsAverage.toFixed(0) + 'g' +
translate('Protein average') + ':</b> ' + proteinAverage.toFixed(0) + 'g' +
translate('Fat average') + ':</b> ' + fatAverage.toFixed(0) + 'g'
$('#daytodaycharts').append('<br><br>' +
'<b>' + translate('TDD average') + ':</b> ' + tddAverage.toFixed(1) + 'U ' +
'<b>' + translate('Carbs average') + ':</b> ' + carbsAverage.toFixed(0) + 'g ' +
'<b>' + translate('Protein average') + ':</b> ' + proteinAverage.toFixed(0) + 'g ' +
'<b>' + translate('Fat average') + ':</b> ' + fatAverage.toFixed(0) + 'g'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See screenshots in PR description

);

function timeTicks (n, i) {
Expand Down
4 changes: 2 additions & 2 deletions views/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@
width: 100%;
height: 90%;
top: 30%;
left: 0%;
left: 0;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just CSS formatting

font-size: 16px;
}
}

.spinner {
margin: 100px auto 0;
Expand Down