-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Fixed negative amount turns to positive amount after sorting duplicates #57033
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 |
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.
lgtm!
sorry i forgot to ask, do we need add tests for this ? if no, please comment your reasoning |
@@ -1380,7 +1380,7 @@ function buildNewTransactionAfterReviewingDuplicates(reviewDuplicateTransaction: | |||
|
|||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't quite get this method:
- Why are there 2 params
isFromExpenseReport
andisFromTrackedExpense
that do the same thing? - What does
isFromTrackedExpense
mean? - 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 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: 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