Skip to content

Commit

Permalink
Added a specific rendering for BG Check events on the Day to Day report.
Browse files Browse the repository at this point in the history
Added an option to hide BG Check and other events on the Day to Day report.
  • Loading branch information
yodax committed Jan 19, 2021
1 parent 8500a1b commit 0ec0f25
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
3 changes: 3 additions & 0 deletions lib/report/reportclient.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,9 @@ var init = function init () {
options.openAps = true;
}

options.bgcheck = $('#rp_optionsbgcheck').is(':checked');
options.othertreatments = $('#rp_optionsothertreatments').is(':checked');

var matchesneeded = 0;

// date range
Expand Down
15 changes: 13 additions & 2 deletions lib/report_plugins/daytoday.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ daytoday.html = function html (client) {
'<label><input type="checkbox" id="rp_optionspredicted"><span style="color:sienna;opacity:0.5">' + translate('Predictions') + '</span></label>' +
'<label><input type="checkbox" id="rp_optionsopenaps"><span style="color:sienna;opacity:0.5">' + translate('OpenAPS') + '</span></label>' +
'<label><input type="checkbox" id="rp_optionsdistribution" checked><span style="color:blue;opacity:0.5">' + translate('Insulin distribution') + '</span></label>' +
'<label><input type="checkbox" id="rp_optionsbgcheck" checked><span style="color:red;opacity:0.5">' + translate('BG Check') + '</span></label>' +
'<label><input type="checkbox" id="rp_optionsothertreatments">' + translate('View all treatments') + '</span></label>' +
'&nbsp;' + translate('Size') +
' <select id="rp_size">' +
' <option x="800" y="250">800x250px</option>' +
Expand Down Expand Up @@ -872,7 +874,16 @@ daytoday.report = function report_daytoday (datastorage, sorteddaystoshow, optio
.attr('y', yScale2(client.utils.scaleMgdl(414)) + padding.top)
.attr('x', xScale2(treatment.mills + times.mins(treatment.duration).msecs / 2) + padding.left)
.text(treatment.reason);
} else if (!treatment.duration) {
} else if (treatment.eventType === 'BG Check' && !treatment.duration && options.bgcheck) {
context.append('circle')
.attr('cx', xScale2(treatment.mills) + padding.left)
.attr('cy', yScale2(scaledTreatmentBG(treatment, data.sgv)) + padding.top)
.attr('fill', 'red')
.style('opacity', 1)
.attr('stroke-width', 1)
.attr('stroke', 'darkred')
.attr('r', 4);
} else if (!treatment.duration && options.othertreatments) {
// other treatments without duration
context.append('circle')
.attr('cx', xScale2(treatment.mills) + padding.left)
Expand All @@ -889,7 +900,7 @@ daytoday.report = function report_daytoday (datastorage, sorteddaystoshow, optio
.attr('y', yScale2(scaledTreatmentBG(treatment, data.sgv)) + padding.top - 10)
.attr('x', xScale2(treatment.mills) + padding.left + 10)
.text(translate(client.careportal.resolveEventName(treatment.eventType)));
} else if (treatment.duration) {
} else if (treatment.duration && options.othertreatments) {
// other treatments with duration
context.append('rect')
.attr('x', xScale2(treatment.mills) + padding.left)
Expand Down

0 comments on commit 0ec0f25

Please sign in to comment.