Skip to content

Commit

Permalink
Bug/chart summary text rounding (#174)
Browse files Browse the repository at this point in the history
Co-authored-by: Sukanya Rath <[email protected]>
  • Loading branch information
banders and sukanya-rath authored Jan 23, 2024
1 parent fde305a commit 5609e35
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions backend/src/v1/services/report-service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ describe('getWageGapTextSummary', () => {
isSuppressed: false,
};
mockCalcs[CALCULATION_CODES.MEDIAN_BONUS_PAY_DIFF_W] = {
value: 10,
value: 10.2,
isSuppressed: false,
};
mockCalcs[CALCULATION_CODES.MEDIAN_BONUS_PAY_DIFF_X] = {
Expand Down Expand Up @@ -304,7 +304,7 @@ describe('getWageGapTextSummary', () => {
expect(text).toContain('median');
expect(text).toContain('bonus pay');
expect(text).toContain(
mockCalcs[CALCULATION_CODES.MEDIAN_BONUS_PAY_DIFF_W].value + '% less',
Math.round(mockCalcs[CALCULATION_CODES.MEDIAN_BONUS_PAY_DIFF_W].value) + '% less',
);
});
});
Expand Down
8 changes: 4 additions & 4 deletions backend/src/v1/services/report-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ const reportServicePrivate = {
}
amountDollars = Math.round(amountDollars * 100) / 100;
if (amountDollars < 1) {
return `${amountDollars * 100} cents`;
return `${Math.round(amountDollars * 100)} cents`;
}
return `$${amountDollars.toFixed(2)}`;
},
Expand Down Expand Up @@ -784,21 +784,21 @@ const reportService = {
),
medianOvertimePayGap: reportServicePrivate.getWageGapTextSummary(
referenceGenderCode,
chartData.meanOvertimePayGap,
chartData.medianOvertimePayGap,
'median',
'overtime pay',
false,
),
meanBonusPayGap: reportServicePrivate.getWageGapTextSummary(
referenceGenderCode,
chartData.meanOvertimePayGap,
chartData.meanBonusPayGap,
'average',
'bonus pay',
false,
),
medianBonusPayGap: reportServicePrivate.getWageGapTextSummary(
referenceGenderCode,
chartData.meanOvertimePayGap,
chartData.medianBonusPayGap,
'median',
'bonus pay',
false,
Expand Down

0 comments on commit 5609e35

Please sign in to comment.