Skip to content

Commit

Permalink
Merge pull request #65 from concord-consortium/186999766-no-round-off…
Browse files Browse the repository at this point in the history
…-value

[#186999766] - Value rounding causes value to change with unit conversion calculations
  • Loading branch information
eireland authored Feb 9, 2024
2 parents 3ed8808 + de437d3 commit 2ff5201
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/components/attribute-selector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ export const AttributesSelector = () => {
const fromUnits = dataType.units[units];
const toUnits = dataType.units[newUnits];
if (operator === "between") {
const lowerValue = Math.round(dataType.convertUnits(fromUnits, toUnits, filter.lowerValue.toString()));
const upperValue = Math.round(dataType.convertUnits(fromUnits, toUnits, filter.upperValue.toString()));
const lowerValue = parseFloat((dataType.convertUnits(fromUnits, toUnits, filter.lowerValue.toString())).toFixed(1));
const upperValue = parseFloat((dataType.convertUnits(fromUnits, toUnits, filter.upperValue.toString())).toFixed(1));
return {
...filter,
lowerValue,
upperValue
};
} else if (operator !== "top" && operator !== "bottom" && operator !== "aboveMean" && operator !== "belowMean" && operator !== "all") {
const value = Math.round(dataType.convertUnits(fromUnits, toUnits, filter.value.toString()));
const value = parseFloat((dataType.convertUnits(fromUnits, toUnits, filter.value.toString())).toFixed(1));
return {
...filter,
value
Expand Down

0 comments on commit 2ff5201

Please sign in to comment.