fix: Distance rate- WS owner can create multiple distance rate with same amount.#53104
Conversation
…ame amount. Signed-off-by: krishna2323 <belivethatkg@gmail.com>
|
@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 <belivethatkg@gmail.com>
Signed-off-by: krishna2323 <belivethatkg@gmail.com>
Signed-off-by: krishna2323 <belivethatkg@gmail.com>
|
@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.
| 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.
Let's remove !(currentRateValue && currentRateValue === r.rate and filter currentRateValue out from convertedRate
There was a problem hiding this comment.
@DylanDylann, sorry I haven't understood what you mean, can you please explain once again?
There was a problem hiding this comment.
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 <belivethatkg@gmail.com>
Signed-off-by: krishna2323 <belivethatkg@gmail.com>
Signed-off-by: krishna2323 <belivethatkg@gmail.com>
Signed-off-by: krishna2323 <belivethatkg@gmail.com>
|
@Krishna2323 ES lint failed |
|
@danieldoglas friendly bump for a review. |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to staging by https://github.com/danieldoglas in version: 9.0.70-0 🚀
|
|
@Krishna2323 PR is fail with #53427 |
|
🚀 Deployed to production by https://github.com/AndrewGable in version: 9.0.70-9 🚀
|
|
It is allowed in OD to create multiple rates with the same amount, so it should be in ND. #55851 |
Explanation of Change
validateRateValueto 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 Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.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