Skip to content

Commit

Permalink
fix: remove float decimal restriction in variables sanitizer (RUN-454) (
Browse files Browse the repository at this point in the history
#564)

<!-- You can erase any parts of this template not applicable to your Pull Request. -->

**Fixes or implements RUN-454**

First step to fix [this bug](https://linear.app/voiceflow/issue/RUN-453/ent-trilogy-greater-than-if-condition-incorrect-within-small-margins)
  • Loading branch information
Sanasar Janjughazyan committed Dec 12, 2024
1 parent 6e2eb5f commit 1ec14e3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/common/src/utils/variables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ export const replaceVariables = (
);
};

// turn float variables to 2 decimal places
// turn float variables to 4 decimal places
export const sanitizeVariables = (variables: Record<string, unknown>): Record<string, unknown> =>
Object.entries(variables).reduce<Record<string, unknown>>((acc, [key, value]) => {
if (typeof value === 'number' && !Number.isInteger(value)) {
acc[key] = (value as number).toFixed(2);
acc[key] = (value as number).toFixed(4);
} else {
acc[key] = value;
}
Expand Down

0 comments on commit 1ec14e3

Please sign in to comment.