Skip to content

Commit

Permalink
bug fixes for #224
Browse files Browse the repository at this point in the history
  • Loading branch information
OHSUCMP committed Aug 30, 2024
1 parent b4cc8bc commit 947be7f
Showing 1 changed file with 41 additions and 30 deletions.
71 changes: 41 additions & 30 deletions src/main/resources/static/js/home.js
Original file line number Diff line number Diff line change
Expand Up @@ -372,47 +372,58 @@ function populateSummaryDiv() {
bpNote.addClass('crisis');
bpNote.show();

} else if (avgSystolic === 0) { // not enough readings to compute average
// Add the placeholder image and text
bpPlaceholder.show();
bpPlaceholder.append("<img src='/images/info-icon.png' class='bp-icon' alt='Enter more blood pressures to see average' title='Enter more blood pressures to see average'/>");
bpPlaceholder.append("<div class='mt-4'>Enter more blood pressures to see average</div>");

} else if (isBasic()) {
removeBootstrapCols(bpIndicatorContainer);
chartContainer.hide();
bpIcon.hide();
bpNote.hide();
bpPlaceholder.hide();
bpContainer.show();

bpLabel.html('Most Recent BP:');
bpLabel.show();
systolic.html(mostRecentBP.systolic.value);
systolic.removeClass('crisis');
diastolic.html(mostRecentBP.diastolic.value);
diastolic.removeClass('crisis');
if (mostRecentBP.systolic === undefined || mostRecentBP.diastolic === undefined) {
bpPlaceholder.html("<div class='mt-4'>No blood pressures to display</div>");
bpPlaceholder.show();
bpContainer.hide();

} else if (isEnhanced()) {
if (aboveGoal) {
bpIcon.html("<img src='/images/stoplight-yellow.png' class='bp-icon' alt='Above Goal' /><span class='tiptext'>Your average BP is above goal. Average is calculated based on a maximum of 12 recent readings. Check the Resources tab to learn more about what to do.</span>");
bpNote.html('Your BP is above your goal!');
} else {
bpIcon.html("<img src='/images/stoplight-green.png' class='bp-icon' alt='At or Below Goal' /><span class='tiptext'>Your average BP is at goal. Average is calculated based on a maximum of 12 recent readings. Check the Resources tab to learn more about what to do.</span>");
bpNote.html('You reached your goal!');
bpPlaceholder.hide();
bpContainer.show();
bpLabel.html('Most Recent BP:');
bpLabel.show();
bpContainer.show();
systolic.html(mostRecentBP.systolic.value);
systolic.removeClass('crisis');
diastolic.html(mostRecentBP.diastolic.value);
diastolic.removeClass('crisis');
}

bpIcon.show();
bpNote.removeClass('crisis');
bpNote.show();
bpPlaceholder.hide();
bpContainer.show();
} else if (isEnhanced()) {
if (avgSystolic === 0) { // not enough readings to compute average
// Add the placeholder image and text
bpPlaceholder.show();
bpPlaceholder.append("<img src='/images/info-icon.png' class='bp-icon' alt='Enter more blood pressures to see average' title='Enter more blood pressures to see average'/>");
bpPlaceholder.append("<div class='mt-4'>Enter more blood pressures to see average</div>");

} else {
if (aboveGoal) {
bpIcon.html("<img src='/images/stoplight-yellow.png' class='bp-icon' alt='Above Goal' /><span class='tiptext'>Your average BP is above goal. Average is calculated based on a maximum of 12 recent readings. Check the Resources tab to learn more about what to do.</span>");
bpNote.html('Your BP is above your goal!');
} else {
bpIcon.html("<img src='/images/stoplight-green.png' class='bp-icon' alt='At or Below Goal' /><span class='tiptext'>Your average BP is at goal. Average is calculated based on a maximum of 12 recent readings. Check the Resources tab to learn more about what to do.</span>");
bpNote.html('You reached your goal!');
}

bpIcon.show();
bpNote.removeClass('crisis');
bpNote.show();
bpPlaceholder.hide();
bpContainer.show();

bpLabel.html('Recent BP Average:').attr('title', 'Average of the last several readings shaded in grey');
systolic.html(avgSystolic);
systolic.removeClass('crisis');
diastolic.html(avgDiastolic);
diastolic.removeClass('crisis');
}

bpLabel.html('Recent BP Average:').attr('title', 'Average of the last several readings shaded in grey');
systolic.html(avgSystolic);
systolic.removeClass('crisis');
diastolic.html(avgDiastolic);
diastolic.removeClass('crisis');
} else {
console.error("Unexpected randomization group")
}
Expand Down

0 comments on commit 947be7f

Please sign in to comment.