Skip to content

Commit

Permalink
Fix #5146 - display of treatment with only Fat and Protein set (#5381)
Browse files Browse the repository at this point in the history
  • Loading branch information
Bartlomiejsz authored and sulkaharo committed Jan 1, 2020
1 parent a4ce06f commit 8139cb9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
13 changes: 8 additions & 5 deletions lib/client/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -542,23 +542,26 @@ function init (client, d3) {
// these used to be semicircles from 1.5708 to 4.7124, but that made the tooltip target too big
{ 'element': '', 'color': 'transparent', 'start': 3.1400, 'end': 3.1432, 'inner': radius.R2, 'outer': radius.R3 }
, { 'element': '', 'color': 'transparent', 'start': 3.1400, 'end': 3.1432, 'inner': radius.R2, 'outer': radius.R4 }
];
]
, arc_data_1_elements = [];

arc_data[0].outlineOnly = !treatment.carbs;
arc_data[2].outlineOnly = !treatment.insulin;

if (treatment.carbs > 0) {
arc_data[1].element = Math.round(treatment.carbs) + ' g';
arc_data_1_elements.push(Math.round(treatment.carbs) + ' g');
}

if (treatment.protein > 0) {
arc_data[1].element = arc_data[1].element + " / " + Math.round(treatment.protein) + ' g';
arc_data_1_elements.push(Math.round(treatment.protein) + ' g');
}

if (treatment.fat > 0) {
arc_data[1].element = arc_data[1].element + " / " + Math.round(treatment.fat) + ' g';
arc_data_1_elements.push(Math.round(treatment.fat) + ' g');
}

arc_data[1].element = arc_data_1_elements.join(' / ');

if (treatment.foodType) {
arc_data[1].element = arc_data[1].element + " " + treatment.foodType;
}
Expand Down Expand Up @@ -1007,7 +1010,7 @@ function init (client, d3) {
};

renderer.drawTreatment = function drawTreatment (treatment, opts, carbratio) {
if (!treatment.carbs && !treatment.insulin) {
if (!treatment.carbs && !treatment.protein && !treatment.fat && !treatment.insulin) {
return;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/profilefunctions.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ function init (profileData) {
profile.getUnits = function getUnits (spec_profile) {
var pu = profile.getCurrentProfile(null, spec_profile)['units'] + ' ';
if (pu.toLowerCase().includes('mmol')) return 'mmol';
return 'mgdl';
return 'mg/dl';
};

profile.getTimezone = function getTimezone (spec_profile) {
Expand Down

0 comments on commit 8139cb9

Please sign in to comment.