Skip to content
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

[HOLD for payment 2024-02-15] [$500] IOU - LHN preview for IOU report does not update to the latest amount when amount is changed #33733

Closed
6 tasks done
lanitochka17 opened this issue Dec 29, 2023 · 37 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Internal Requires API changes or must be handled by Expensify staff

Comments

@lanitochka17
Copy link

lanitochka17 commented Dec 29, 2023

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: 1.4.19-1
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by: Applause - Internal Team
Slack conversation:

Action Performed:

  1. Go to FAB > Request money > Manual
  2. Create a manual request
  3. Click on IOU preview twice to go to details view
  4. Click Amount and change the amount
  5. Return to IOU report

Expected Result:

The amount requested in LHN for the IOU report will update to the latest amount

Actual Result:

The amount requested in LHN for the IOU report does not update to the latest amount

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence

20231229_183508.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01e4739cbceab8e8b5
  • Upwork Job ID: 1740529182306668544
  • Last Price Increase: 2024-01-05
@lanitochka17 lanitochka17 added External Added to denote the issue can be worked on by a contributor Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Dec 29, 2023
Copy link

melvin-bot bot commented Dec 29, 2023

Job added to Upwork: https://www.upwork.com/jobs/~01e4739cbceab8e8b5

@melvin-bot melvin-bot bot changed the title IOU - LHN preview for IOU report does not update to the latest amount when amount is changed [$500] IOU - LHN preview for IOU report does not update to the latest amount when amount is changed Dec 29, 2023
Copy link

melvin-bot bot commented Dec 29, 2023

Triggered auto assignment to @laurenreidexpensify (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Dec 29, 2023
Copy link

melvin-bot bot commented Dec 29, 2023

Bug0 Triage Checklist (Main S/O)

  • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
  • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
    • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
  • This bug is reproducible using the reproduction steps in the OP. S/O
    • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
    • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
  • This issue is filled out as thoroughly and clearly as possible
    • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
  • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync

Copy link

melvin-bot bot commented Dec 29, 2023

Triggered auto assignment to Contributor-plus team member for initial proposal review - @allroundexperts (External)

@melvin-bot melvin-bot bot added the Overdue label Jan 1, 2024
Copy link

melvin-bot bot commented Jan 1, 2024

@allroundexperts, @laurenreidexpensify Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

1 similar comment
Copy link

melvin-bot bot commented Jan 1, 2024

@allroundexperts, @laurenreidexpensify Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@laurenreidexpensify
Copy link
Contributor

Waiting for proposals

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Jan 2, 2024
@laurenreidexpensify
Copy link
Contributor

Still waiting for proposals

@melvin-bot melvin-bot bot removed the Overdue label Jan 5, 2024
Copy link

melvin-bot bot commented Jan 5, 2024

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

@melvin-bot melvin-bot bot added the Overdue label Jan 8, 2024
@laurenreidexpensify
Copy link
Contributor

No proposals yet - waiting to see if we get any

@melvin-bot melvin-bot bot removed the Overdue label Jan 8, 2024
@koko57
Copy link
Contributor

koko57 commented Jan 10, 2024

@laurenreidexpensify I can look into it, as I was working on LHN previews 🙂 But I also see that the total is not updated here (right upper corner) am I right?
Screenshot 2024-01-10 at 10 22 45

cc @mountiny

@kameshwarnayak
Copy link
Contributor

Proposal

Please re-state the problem that we are trying to solve in this issue.

IOU - LHN preview for IOU report does not update to the latest amount when amount is changed

What is the root cause of that problem?

The API call UpdateMoneyRequestAmountAndCurrency does not change the total value in the report_XXXXXXX onyx data instead adds the diff to nonReimbursableTotal as seen in the screenshot below. Similarly the originalMessage?.amount has the original values when the record was created

Screenshot 2024-01-10 at 4 21 59 PM

But the LHN and Title reads from originalMessage?.amount and report.total respectively which still has old value as seen in the below codes.

const amount = originalMessage?.amount;

const total = moneyRequestReport?.total ?? 0;

What changes do you think we should make in order to solve the problem?

To solve this we need to subtract nonReimbursableTotal from the total. Make the following changes to achieve the right result
Replace

const total = moneyRequestReport?.total ?? 0;

With

    let nonReimbursableSpend = moneyRequestReport?.nonReimbursableTotal ?? 0;
    const total = (moneyRequestReport?.total ?? 0) - nonReimbursableSpend;

Replace

App/src/libs/ReportUtils.ts

Lines 2141 to 2147 in 76e5b1c

const amount = originalMessage?.amount;
const currency = originalMessage?.currency ?? report.currency ?? '';
const amountToDisplay = CurrencyUtils.convertToDisplayString(Math.abs(amount), currency);
// We only want to show the actor name in the preview if it's not the current user who took the action
const requestorName = lastActorID && lastActorID !== currentUserAccountID ? getDisplayNameForParticipant(lastActorID, !isPreviewMessageForParentChatReport) : '';
return `${requestorName ? `${requestorName}: ` : ''}${Localize.translateLocal('iou.requestedAmount', {formattedAmount: amountToDisplay})}`;

With (amountToDisplay becomes in formattedAmount in the return)

    // We only want to show the actor name in the preview if it's not the current user who took the action
    const requestorName = lastActorID && lastActorID !== currentUserAccountID ? getDisplayNameForParticipant(lastActorID, !isPreviewMessageForParentChatReport) : '';
    return `${requestorName ? `${requestorName}: ` : ''}${Localize.translateLocal('iou.requestedAmount', {formattedAmount: formattedAmount})}`;

And finally replace

let totalSpend = moneyRequestReport.total ?? 0;

with

    let totalSpend = (moneyRequestReport.total ?? 0) - nonReimbursableSpend;

This will fix the discrepancy in the split that we see in the report split seen below

Screenshot 2024-01-10 at 5 01 25 PM

The above fix also works when we have multiple requests in one report

Result :

Single request

screen-recording-2024-01-10.mp4

Multiple requests

multiple-requests.mp4

What alternative solutions did you explore? (Optional)

NA

@melvin-bot melvin-bot bot added the Overdue label Jan 10, 2024
@mountiny
Copy link
Contributor

thanks @koko57 I think the proposal from @kameshwarnayak looks good

@grgia or @luacmartins would you like to take this one as CME since you have experience with this?

@luacmartins luacmartins self-assigned this Jan 10, 2024
@melvin-bot melvin-bot bot removed the Overdue label Jan 10, 2024
@luacmartins
Copy link
Contributor

Yea, I can take this one. Thanks for the work so far @koko57 and @kameshwarnayak. I looked at the OP and I actually think this is a backend issue. We're not updating the report total on the new method. Here's the PR to fix that https://github.com/Expensify/Auth/pull/9629

@melvin-bot melvin-bot bot added the Awaiting Payment Auto-added when associated PR is deployed to production label Feb 8, 2024
@melvin-bot melvin-bot bot changed the title [$500] IOU - LHN preview for IOU report does not update to the latest amount when amount is changed [HOLD for payment 2024-02-15] [$500] IOU - LHN preview for IOU report does not update to the latest amount when amount is changed Feb 8, 2024
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Feb 8, 2024
Copy link

melvin-bot bot commented Feb 8, 2024

Reviewing label has been removed, please complete the "BugZero Checklist".

Copy link

melvin-bot bot commented Feb 8, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.38-6 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

If no regressions arise, payment will be issued on 2024-02-15. 🎊

For reference, here are some details about the assignees on this issue:

  • @situchan requires payment (Needs manual offer from BZ)

Copy link

melvin-bot bot commented Feb 8, 2024

BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

  • [@situchan] The PR that introduced the bug has been identified. Link to the PR:
  • [@situchan] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:
  • [@situchan] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion:
  • [@situchan] Determine if we should create a regression test for this bug.
  • [@situchan] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
  • [@laurenreidexpensify] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@laurenreidexpensify laurenreidexpensify added Daily KSv2 and removed Weekly KSv2 labels Feb 15, 2024
@melvin-bot melvin-bot bot added Overdue Daily KSv2 and removed Daily KSv2 Overdue labels Feb 15, 2024
Copy link

melvin-bot bot commented Feb 15, 2024

Payment Summary

Upwork Job

  • ROLE: @situchan paid $(AMOUNT) via Upwork (LINK)

BugZero Checklist (@laurenreidexpensify)

  • I have verified the correct assignees and roles are listed above and updated the neccesary manual offers
  • I have verified that there are no duplicate or incorrect contracts on Upwork for this job (https://www.upwork.com/ab/applicants/1740529182306668544/hired)
  • I have paid out the Upwork contracts or cancelled the ones that are incorrect
  • I have verified the payment summary above is correct

@laurenreidexpensify
Copy link
Contributor

Offer sent to @situchan in Upwork https://www.upwork.com/jobs/~0194ec363293ea15d0

@kbecciv
Copy link

kbecciv commented Feb 16, 2024

@laurenreidexpensify Do you need to include this issue in weekly retest? It has weekly re-test label.

@melvin-bot melvin-bot bot added the Overdue label Feb 19, 2024
@laurenreidexpensify laurenreidexpensify added retest-weekly Apply this label if you want this issue tested on a Weekly basis by Applause and removed retest-weekly Apply this label if you want this issue tested on a Weekly basis by Applause labels Feb 19, 2024
@laurenreidexpensify
Copy link
Contributor

@luacmartins can you confirm if payment is bundled under a payment in #35818 or needs additional payment - I got a little confused here. Thanks!

@melvin-bot melvin-bot bot removed the Overdue label Feb 19, 2024
@situchan
Copy link
Contributor

The PR linked 2 issues. I am not assigned in #34411 so payment can be handled here.
cc: @mountiny

@luacmartins
Copy link
Contributor

Agree that we can handle it here since @situchan is not assigned in #34411

@mountiny
Copy link
Contributor

Sounds good, lets handle the $500 payment here

@laurenreidexpensify
Copy link
Contributor

laurenreidexpensify commented Feb 20, 2024

Payment Summary:

C+: $500 payment issued in Upwork @situchan

@laurenreidexpensify
Copy link
Contributor

@situchan pls complete any necessary checklists

@situchan
Copy link
Contributor

Originally, issue was in backend as per #33733 (comment).
We can skip regression test as reported by QA team.

@mvtglobally
Copy link

Issue not reproducible during KI retests. (First week)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Internal Requires API changes or must be handled by Expensify staff
Projects
None yet
Development

No branches or pull requests