Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 5 additions & 2 deletions lib/client/chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ function init (client, d3, $) {
}

function dynamicDomainOrElse (defaultDomain) {
if (client.settings.scaleY === 'linear' || client.settings.scaleY === 'log-dynamic') {
if (client.entries && (client.entries.length > 0) && (client.settings.scaleY === 'linear' || client.settings.scaleY === 'log-dynamic')) {
return dynamicDomain();
} else {
return defaultDomain;
Expand Down Expand Up @@ -714,7 +714,10 @@ function init (client, d3, $) {
}

maxForecastMills = Math.min(focusHoursAheadMills, maxForecastMills);
client.forecastTime = maxForecastMills > 0 ? maxForecastMills - client.sbx.lastSGVMills() : 0;

var lastSGVMills = client.sbx.lastSGVMills();

client.forecastTime = ((maxForecastMills > 0) && lastSGVMills) ? maxForecastMills - lastSGVMills : client.defaultForecastTime;
}
};

Expand Down
2 changes: 1 addition & 1 deletion lib/client/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ client.load = function load (serverSettings, callback) {

client.now = Date.now();
client.ddata = require('../data/ddata')();
client.forecastTime = times.mins(30).msecs;
client.forecastTime = client.defaultForecastTime = times.mins(30).msecs;
client.entries = [];
client.ticks = require('./ticks');

Expand Down
5 changes: 5 additions & 0 deletions lib/report_plugins/glucosedistribution.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,11 @@ glucosedistribution.report = function report_glucosedistribution (datastorage, s

var glucose_data = [data[0]];

if (data.length === 0) {
$('#glucosedistribution-days').text(translate('Result is empty'));
return;
}

// data cleaning pass 1 - add interpolated missing points
for (i = 0; i <= data.length - 2; i++) {
var entry = data[i];
Expand Down