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

Added a specific rendering for BG Check events on the Day to Day report. #6530

Merged
merged 3 commits into from
Feb 2, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
Added a specific rendering for BG Check events on the Day to Day report.
Added an option to hide BG Check and other events on the Day to Day report.
  • Loading branch information
yodax committed Feb 1, 2021
commit b98c131a34bc4fba513cc18f22f611c2dd5c637a
4 changes: 3 additions & 1 deletion lib/report/reportclient.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,9 @@ var init = function init () {
options.cob = true;
options.openAps = true;
}

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

const reportStorage = require('./reportstorage');
reportStorage.saveProps(options);
var matchesneeded = 0;
Expand Down
4 changes: 3 additions & 1 deletion lib/report/reportstorage.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ const defaultValues = {
predicted: false,
openAps: false,
insulindistribution: true,
predictedTruncate: true
predictedTruncate: true,
bgcheck: true,
othertreatments: false
};
let cachedProps;

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 @@ -35,6 +35,8 @@ daytoday.html = function html (client) {
`<label><input type="checkbox" id="rp_optionspredicted" ${reportStorage.getValue('predicted') ? "checked" : ""}><span style="color:sienna;opacity:0.5">${translate('Predictions')}</span></label>` +
`<label><input type="checkbox" id="rp_optionsopenaps" ${reportStorage.getValue('openAps') ? "checked" : ""}><span style="color:sienna;opacity:0.5">${translate('OpenAPS')}</span></label>` +
`<label><input type="checkbox" id="rp_optionsdistribution" ${reportStorage.getValue('insulindistribution') ? "checked" : ""}><span style="color:blue;opacity:0.5">${translate('Insulin distribution')}</span></label>` +
`<label><input type="checkbox" id="rp_optionsbgcheck" ${reportStorage.getValue('bgcheck') ? "checked" : ""}><span style="color:#ff0000;opacity:0.5">${translate('BG Check')}</span></label>` +
`<label><input type="checkbox" id="rp_optionsothertreatments" ${reportStorage.getValue('othertreatments') ? "checked" : ""}>${translate('View all treatments')}</span></label>` +
'&nbsp;' + translate('Size') +
' <select id="rp_size">' +
' <option x="800" y="250">800x250px</option>' +
Expand Down Expand Up @@ -873,7 +875,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 @@ -890,7 +901,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