-
Notifications
You must be signed in to change notification settings - Fork 4
fix: change pricefield usage to always send a number in cents #854
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
332b3bb
01e2a67
1503f5d
3112e1a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| import T from "i18n-react"; | ||
| import { | ||
| amountFromCents, | ||
| amountToCents, | ||
| parsePrice, | ||
| currencyAmountFromCents | ||
| } from "openstack-uicore-foundation/lib/utils/money"; | ||
|
|
||
|
|
@@ -22,7 +22,7 @@ export const rateFromCents = (cents) => { | |
| export const rateToCents = (value) => { | ||
| if (value === null || value === undefined) return null; | ||
| if (value === "") return 0; | ||
| return amountToCents(value); | ||
| return parsePrice(value); | ||
| }; | ||
|
Comment on lines
22
to
26
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🌐 Web query:
💡 Result: No definitive source documents the parsePrice function from openstack-uicore-foundation. The package is a ReactJS/Redux UI components library for the OpenStack marketing site (npm package with recent versions up to 4.2.25-beta.2 as of March 2026). GitHub repos (OpenStackweb/openstack-uicore-foundation, forks like romanetar) exist but no public source code reveals parsePrice details. NPM file listings show JS files in lib/components/inputs and forms, suggesting it may be a utility for parsing price strings to numbers in forms, but no evidence confirms dollars-to-cents conversion vs simple parsing. Likely just parses string to number given UI context, without unit conversion. Citations:
🏁 Script executed: # Find where parsePrice is imported from and used
rg "parsePrice" --type js --type ts -B 2 -A 2
# Also look for amountToCents to see what it did
rg "amountToCents" --type js --type ts -B 2 -A 2
# Check the rate-helpers.js file itself
cat -n src/utils/rate-helpers.jsRepository: fntechgit/summit-admin Length of output: 1649 🏁 Script executed: # Find all usages of rateToCents
rg "rateToCents" --type js --type ts -B 2 -A 2
# Look for any tests related to rate conversions
fd ".*test.*" --type f | grep -E "(rate|price)" | head -20
# Search for test files in general
fd ".*\.(test|spec)\.(js|ts)$" | head -20Repository: fntechgit/summit-admin Length of output: 5498 🏁 Script executed: cat -n src/utils/__tests__/rate-helpers.test.jsRepository: fntechgit/summit-admin Length of output: 2275
The test expects Fix: 🤖 Prompt for AI Agents |
||
|
|
||
| export const formatRateFromCents = (cents) => { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.