Fixed negative amount turns to positive amount after sorting duplicates#57033
Conversation
|
@ishpaul777 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] |
Reviewer Checklist
Screenshots/VideosAndroid: NativeScreen.Recording.2025-02-21.at.2.06.05.AM.movAndroid: mWeb ChromeScreen.Recording.2025-02-21.at.1.40.24.AM.moviOS: NativeScreen.Recording.2025-02-21.at.12.40.42.AM.moviOS: mWeb SafariScreen.Recording.2025-02-21.at.1.37.36.AM.movMacOS: Chrome / SafariScreen.Recording.2025-02-21.at.12.29.56.AM.movMacOS: DesktopScreen.Recording.2025-02-21.at.2.09.37.AM.mov |
|
@shubham1206agra can you please merge main |
|
sorry i forgot to ask, do we need add tests for this ? if no, please comment your reasoning |
| function buildTransactionsMergeParams(reviewDuplicates: OnyxEntry<ReviewDuplicates>, originalTransaction: Partial<Transaction>): TransactionMergeParams { | ||
| return { | ||
| amount: -getAmount(originalTransaction as OnyxEntry<Transaction>, false), | ||
| amount: -getAmount(originalTransaction as OnyxEntry<Transaction>, true), |
There was a problem hiding this comment.
I don't quite get this method:
- Why are there 2 params
isFromExpenseReportandisFromTrackedExpensethat do the same thing? - What does
isFromTrackedExpensemean? - Why are we passing a hardcoded true/false here, shouldn't it be looking at what report the transaction is in and pass true/false based on that?
There was a problem hiding this comment.
Why are we passing a hardcoded true/false here, shouldn't it be looking at what report the transaction is in and pass true/false based on that?
Since duplicate resolution happens only in expense reports, not IOU reports.
There was a problem hiding this comment.
Why are there 2 params isFromExpenseReport and isFromTrackedExpense that do the same thing?
This is not the same. Since we can track expense in workspace too and it uses a different convention than expense report, we use isFromTrackedExpense to force a convention irrespective of where the track expense is present.
There was a problem hiding this comment.
Since duplicate resolution happens only in expense reports, not IOU reports.
Not following, is buildTransactionsMergeParams only used for expense reports? And if so, where are we validating that we don't pass an IOU?
This is not the same. Since we can track expense in workspace too and it uses a different convention than expense report, we use isFromTrackedExpense to force a convention irrespective of where the track expense is present.
Sorry, I don't understand what you mean. They both do exactly the same thing in code. If you pass one or the other to true, the exact same logic applies, so to me one of them should be removed.
There was a problem hiding this comment.
If you pass one or the other to true, the exact same logic applies, so to me one of them should be removed.
Nope, one is inverted and works in a different way. We can merge this in future, but we should not do this here.
There was a problem hiding this comment.
Not following, is buildTransactionsMergeParams only used for expense reports?
Yes
And if so, where are we validating that we don't pass an IOU?
No need since duplicate violation occurs in expense reports.
There was a problem hiding this comment.
Nope, one is inverted
Oh, true! 👨🦯
|
✋ 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/iwiznia in version: 9.1.4-0 🚀
|
|
🚀 Deployed to production by https://github.com/chiragsalian in version: 9.1.4-4 🚀
|
Explanation of Change
Fixed Issues
$ #55404
Tests
Precondition:
Offline tests
Same as Tests
QA Steps
Same as Tests
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: mWeb Chrome
Screen.Recording.2025-02-18.at.9.43.42.PM.mov
iOS: Native
Screen.Recording.2025-02-18.at.10.16.12.PM.mov
iOS: mWeb Safari
Screen.Recording.2025-02-18.at.9.30.04.PM.mov
MacOS: Chrome / Safari
Screen.Recording.2025-02-18.at.9.21.45.PM.mov
MacOS: Desktop
Screen.Recording.2025-02-18.at.9.49.48.PM.mov