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

Don't use dynamic scale unless entries in database #5195

Merged
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