diff --git a/lib/client/clock-client.js b/lib/client/clock-client.js
index ce4b6fb060d..18b5116f94d 100644
--- a/lib/client/clock-client.js
+++ b/lib/client/clock-client.js
@@ -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('
-?-
');
+ $('#arrow').hide();
+ } else {
+ $errorMessage.show();
+ }
+ return;
+ } else {
+ $errorMessage.length && $errorMessage.hide();
+ $('#arrow').show();
+ }
+
let last = new Date(rec.date);
let now = new Date();
@@ -163,4 +179,4 @@ client.init = function init () {
setInterval(client.query, 1 * 60 * 1000);
};
-module.exports = client;
\ No newline at end of file
+module.exports = client;
diff --git a/lib/client/index.js b/lib/client/index.js
index 057aac6e08b..979348c0cb5 100644
--- a/lib/client/index.js
+++ b/lib/client/index.js
@@ -1,5 +1,4 @@
'use strict';
-'use strict';
var _ = require('lodash');
var $ = (global && global.$) || require('jquery');
@@ -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);
@@ -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 {
diff --git a/lib/client/renderer.js b/lib/client/renderer.js
index 587489d868c..eb356b6e9e5 100644
--- a/lib/client/renderer.js
+++ b/lib/client/renderer.js
@@ -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()) {
return chart().futureOpacity(data.mills - client.latestSGV.mills);
} else {
return 0.5;
@@ -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);
})
.attr('stroke-width', function(d) {
return d.type === 'mbg' ? 2 : d.type === 'forecast' ? 2 : 0;
@@ -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) {
@@ -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) {
@@ -1009,7 +1009,7 @@ 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')
@@ -1017,7 +1017,7 @@ function init (client, d3) {
.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')
diff --git a/lib/report_plugins/daytoday.js b/lib/report_plugins/daytoday.js
index 72eaf0de3a0..5f7983480c5 100644
--- a/lib/report_plugins/daytoday.js
+++ b/lib/report_plugins/daytoday.js
@@ -102,10 +102,11 @@ daytoday.report = function report_daytoday (datastorage, sorteddaystoshow, optio
var fatAverage = fatSum / datastorage.alldays;
if (options.insulindistribution)
- $('#daytodaycharts').append('
' + translate('TDD average') + ': ' + tddAverage.toFixed(1) + 'U ' +
- translate('Carbs average') + ': ' + carbsAverage.toFixed(0) + 'g' +
- translate('Protein average') + ': ' + proteinAverage.toFixed(0) + 'g' +
- translate('Fat average') + ': ' + fatAverage.toFixed(0) + 'g'
+ $('#daytodaycharts').append('
' +
+ '' + translate('TDD average') + ': ' + tddAverage.toFixed(1) + 'U ' +
+ '' + translate('Carbs average') + ': ' + carbsAverage.toFixed(0) + 'g ' +
+ '' + translate('Protein average') + ': ' + proteinAverage.toFixed(0) + 'g ' +
+ '' + translate('Fat average') + ': ' + fatAverage.toFixed(0) + 'g'
);
function timeTicks (n, i) {
diff --git a/views/index.html b/views/index.html
index cf13cdb91a7..3a156008903 100644
--- a/views/index.html
+++ b/views/index.html
@@ -54,9 +54,9 @@
width: 100%;
height: 90%;
top: 30%;
- left: 0%;
+ left: 0;
font-size: 16px;
-}
+}
.spinner {
margin: 100px auto 0;