-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
fix: Distance rate- WS owner can create multiple distance rate with same amount. #53104
base: main
Are you sure you want to change the base?
Conversation
…ame amount. Signed-off-by: krishna2323 <[email protected]>
@DylanDylann Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
Signed-off-by: krishna2323 <[email protected]>
Signed-off-by: krishna2323 <[email protected]>
Signed-off-by: krishna2323 <[email protected]>
@Krishna2323 Please merge the new main |
src/libs/PolicyDistanceRatesUtils.ts
Outdated
function validateRateValue( | ||
values: FormOnyxValues<RateValueForm>, | ||
customUnitRates: Record<string, Rate>, | ||
currency: string, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
currency: string, |
src/libs/PolicyDistanceRatesUtils.ts
Outdated
|
||
// Allow one more decimal place for accuracy | ||
const rateValueRegex = RegExp(String.raw`^-?\d{0,8}([${getPermittedDecimalSeparator(decimalSeparator)}]\d{0,${CONST.MAX_TAX_RATE_DECIMAL_PLACES}})?$`, 'i'); | ||
if (!rateValueRegex.test(parsedRate) || parsedRate === '') { | ||
if (ratesList.some((r) => r.rate === convertedRate && !(currentRateValue && currentRateValue === r.rate))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's remove !(currentRateValue && currentRateValue === r.rate and filter currentRateValue out from convertedRate
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DylanDylann, sorry I haven't understood what you mean, can you please explain once again?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh I made a mistake. I mean that we should remove currentRateValue from ratesList and don't need to check !(currentRateValue && currentRateValue === r.rate
Reviewer Checklist
Screenshots/VideosAndroid: NativeScreen.Recording.2024-11-28.at.11.12.28.movAndroid: mWeb ChromeScreen.Recording.2024-11-28.at.11.08.41.moviOS: NativeScreen.Recording.2024-11-28.at.11.13.12.moviOS: mWeb SafariScreen.Recording.2024-11-28.at.11.12.51.movMacOS: Chrome / SafariScreen.Recording.2024-11-28.at.11.05.06.movMacOS: DesktopScreen.Recording.2024-11-28.at.11.13.33.mov |
Signed-off-by: krishna2323 <[email protected]>
Signed-off-by: krishna2323 <[email protected]>
Signed-off-by: krishna2323 <[email protected]>
Explanation of Change
validateRateValue
to also check for existing rates with the same value and return error message if true.Fixed Issues
$ #51769
PROPOSAL: #51769 (comment)
Tests
A rate with value ${rate} already exists.
A rate with value ${rate} already exists.
Offline tests
A rate with value ${rate} already exists.
A rate with value ${rate} already exists.
QA Steps
A rate with value ${rate} already exists.
A rate with value ${rate} already exists.
// TODO: These must be filled out, or the issue title must include "[No QA]."
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)src/languages/*
files and using the translation methodSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label and/or tagged@Expensify/design
so the design team can review the changes.ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Android: Native
android_native.mp4
Android: mWeb Chrome
android_chrome.mp4
iOS: Native
ios_native.mp4
iOS: mWeb Safari
ios_safari.mp4
MacOS: Chrome / Safari
web_chrome.mp4
MacOS: Desktop
desktop_app.mp4