Commit 4d0e5c9
committed
fix(RecipeFakerService): correctly calculate left_digits for numeric and currency fields based on precision - scale
- Updated buildNumericRecipeValueWithPrecisionAndScale and buildCurrencyRecipeValueWithPrecisionAndScale to use left_digits = precision - effectiveScale, ensuring accurate representation of digits before the decimal point.
- Adjusted the corresponding test to expect left_digits=16 for a currency field with 18 precision and 2 scale, matching the correct calculation. This fixes a potential issue where total precision was mistakenly used as left_digits, leading to incorrect fake data generation.1 parent 303b874 commit 4d0e5c9
File tree
2 files changed
+6
-5
lines changed- src/treecipe/src
- RecipeFakerService.ts/SnowfakeryRecipeFakerService
- RecipeService/tests
2 files changed
+6
-5
lines changedLines changed: 5 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
407 | 407 | | |
408 | 408 | | |
409 | 409 | | |
410 | | - | |
| 410 | + | |
411 | 411 | | |
412 | 412 | | |
413 | | - | |
| 413 | + | |
414 | 414 | | |
415 | | - | |
| 415 | + | |
416 | 416 | | |
417 | 417 | | |
418 | 418 | | |
419 | 419 | | |
420 | 420 | | |
421 | 421 | | |
422 | | - | |
| 422 | + | |
| 423 | + | |
423 | 424 | | |
424 | 425 | | |
425 | 426 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
136 | 136 | | |
137 | 137 | | |
138 | 138 | | |
139 | | - | |
| 139 | + | |
140 | 140 | | |
141 | 141 | | |
142 | 142 | | |
| |||
0 commit comments