-
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
[$250] Search-Invoice with +2 expense submitted in OD is displayed with a negative total amount in ND #53045
Comments
Triggered auto assignment to @mallenexpensify ( |
Edited by proposal-police: This proposal was edited at 2024-11-28 02:32:31 UTC. ProposalPlease re-state the problem that we are trying to solve in this issue.The total invoice report amount is shown in negative. What is the root cause of that problem?The total amount of the invoice report is in negative, the same as expense report. However, when we show the total amount, we only negate the expense report. App/src/components/SelectionList/Search/ReportListItem.tsx Lines 39 to 44 in f4f8da7
So, for invoice report, the negative amount is shown. What changes do you think we should make in order to solve the problem?We need to check for invoice type too and if it's true, then we negate it too (multiply by -1)
(or we can use Math.abs if it's not an expense report) There are multiple places where we check for expense report type to multiply it by -1 where we can probably apply the same fix, but looks like it's currently not possible to view an invoice report, so not sure how to test the other cases. To handle the other cases too, we can create a new util function in IOUUtils called
And then we can use it like this App/src/components/SelectionList/Search/ReportListItem.tsx Lines 39 to 44 in 10a7be8
|
Job added to Upwork: https://www.upwork.com/jobs/~021861216736472283553 |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @ikevin127 ( |
Music to my ears @bernhardoj :) When I click on |
Let's go with @bernhardoj's proposal since the RCA makes sense and the proposed solution fixes the issue. Regarding the solution, since the component already imports total *= ReportUtils.isExpenseReport(reportItem) || ReportUtils.isInvoiceReport(reportItem) ? -1 : 1; 🎀👀🎀 C+ reviewed
I don't see it related to the negative amount issue in any way which would justify extending the scope of this issue given the context shared in #53045 (comment) - I think it should be treated as a separate issue. |
Triggered auto assignment to @iwiznia, see https://stackoverflow.com/c/expensify/questions/7972 for more details. |
Anyone knows why we invert the amount for expense (and now invoice) but not other types? Solution sounds good, but it seems like we should centralize this logic in one function so we don't have the same bug in many places and try to find all places where this logic exists... I see for example we have it also here Can you update the proposal to include that please? |
It's explained here (invoice not included) App/src/libs/TransactionUtils/index.ts Lines 428 to 449 in 4c47abe
I think we can create a util function in IOUUtils called |
Ah nice, let's ensure we have that explanation in the new method and that we use it there too as it seems that code is also wrong |
I don't think so, invoices can be positive or negative, same as expense reports. IOUs are the only ones that are different |
Updated my proposal to include the util function.
Which part of |
Actually not sure if it is wrong, because I now realize I have no idea what |
My first thought that it should be true for self DM track, but I just realized we can track expense in workspace too. It was added in #38709, specifically this commit, but looks like we never make use of the The only code that uses it is this:
It's from this PR: #40443 Maybe @ishpaul777 can help us clarify the purpose of that param. |
ccing @thienlnam too since he was reviewer of #38709 |
@iwiznia, @mallenexpensify, @ikevin127 Uh oh! This issue is overdue by 2 days. Don't forget to update your issues! |
Waiting on input from the people pinged above |
|
From the blame history, I recall initially being confused about how tracked expenses should be moved to the workspace chat. In self-DM, tracked expenses were stored as negative values. When moving them to the workspace, I converted them to +ive. At that time, I added this check. However, after i was corrected by Jack, I removed the parameter locally. Unfortunately, I believe I missed removing the parameter from the function during cleanup, which was an oversight. As for why the param is used later, I don't have much context, but it appears to be related to this commit: 228c47705cc4a06d8d0a343be222e8e952523039. |
@iwiznia, @mallenexpensify, @ikevin127 Whoops! This issue is 2 days overdue. Let's get this updated quick! |
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸 |
Still working on a decision regarding the direction of this issue and its fix. |
@thienlnam 👀 above plz cuz you were the reviewier on the PR below.
|
Could someone summarize what the confusion is regarding? If it's about the isFromTrackedExpense param, it's been a while but my guess is from when you convert a tracked expense to a reimbursable one since we flip the amount (negative to positive). If it's not used anymore, let's just remove it |
Yes, it's the
From this commit, previously we get the transaction amount by My guess with why we pass App/src/libs/TransactionUtils/index.ts Lines 423 to 430 in 3baf965
I think we can safely remove |
Not overdue - still discussing. |
@iwiznia @mallenexpensify @ikevin127 this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks! |
Not overdue - still discussing. |
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸 |
If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!
Version Number: 9.0.66-0
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail: https://expensify.testrail.io/index.php?/tests/view/5256232
Issue reported by: Applause Internal Team
Action Performed:
Expected Result:
The invoice with at least 2 expenses submitted in OD is displayed with a positive total amount in ND.
Actual Result:
The invoice with at least 2 expenses submitted in OD is displayed with a negative total amount in ND.
Workaround:
Unknown
Platforms:
Screenshots/Videos
Bug6674480_1732394559495.total_negative_amount.mp4
View all open jobs on GitHub
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @ikevin127The text was updated successfully, but these errors were encountered: