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-11-22] [HOLD FOR #52007] [$250] Search - Total amount does not auto update after changing the expense currency #49493

Open
2 of 6 tasks
IuliiaHerets opened this issue Sep 19, 2024 · 77 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 External Added to denote the issue can be worked on by a contributor Needs Reproduction Reproducible steps needed Overdue

Comments

@IuliiaHerets
Copy link

IuliiaHerets commented Sep 19, 2024

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: 9.0.38-0
Reproducible in staging?: Y
Reproducible in production?: Y
Email or phone of affected tester (no customers): applausetester+kh010901@applause.expensifail.com
Issue reported by: Applause Internal Team

Action Performed:

  1. Go to staging.new.expensify.com
  2. Go to DM.
  3. Submit two expenses.
  4. Go to Search.
  5. Go to Outstanding.
  6. Click View next to the submitted expense.
  7. Click Amount.
  8. Change the currency and save it.
  9. Dismiss the RHP.

Expected Result:

The total amount should auto update after changing the expense currency.

Actual Result:

The total amount does not auto update after changing the expense currency.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug6608678_1726739142065.bandicam_2024-09-19_17-41-06-770.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021845906959284211554
  • Upwork Job ID: 1845906959284211554
  • Last Price Increase: 2024-10-29
  • Automatic offers:
    • situchan | Reviewer | 104685821
    • huult | Contributor | 104685823
Issue OwnerCurrent Issue Owner: @
@IuliiaHerets IuliiaHerets added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Sep 19, 2024
Copy link

melvin-bot bot commented Sep 19, 2024

Triggered auto assignment to @CortneyOfstad (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

@IuliiaHerets
Copy link
Author

We think that this bug might be related to #wave-control

@IuliiaHerets
Copy link
Author

@CortneyOfstad FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors

@CyberAndrii
Copy link
Contributor

Proposal

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

Total amount does not auto update after changing the expense currency

What is the root cause of that problem?

We compute the total here

const formattedTotal = TransactionUtils.getAmount(transactionItem, isExpenseReport);

However, this function (getTransactionItemCommonFormattedProperties) is only called if the route/query changes. When we change the currency the route/query doesn't change, and we read the outdated total value.

const {type, status, sortBy, sortOrder, hash} = queryJSON;
const [currentSearchResults] = useOnyx(`${ONYXKEYS.COLLECTION.SNAPSHOT}${hash}`);

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

Instead of reading from the formattedTotal property, we can calculate the total based on the updated transaction list.

Replace this line

let amount = CurrencyUtils.convertToDisplayString(transactionItem.formattedTotal, currency);

with the following code

const isExpenseReport = transactionItem.reportType === CONST.REPORT.TYPE.EXPENSE;
const total = TransactionUtils.getAmount(transactionItem, isExpenseReport);
let amount = CurrencyUtils.convertToDisplayString(total, currency);

A similar approach is already implemented for reports.

Finally, we can remove the formattedTotal property from here

const formattedTotal = TransactionUtils.getAmount(transactionItem, isExpenseReport);

@melvin-bot melvin-bot bot added the Overdue label Sep 23, 2024
Copy link

melvin-bot bot commented Sep 23, 2024

@CortneyOfstad Whoops! This issue is 2 days overdue. Let's get this updated quick!

@CortneyOfstad CortneyOfstad added Needs Reproduction Reproducible steps needed retest-weekly Apply this label if you want this issue tested on a Weekly basis by Applause labels Sep 23, 2024
@CortneyOfstad
Copy link
Contributor

So one aspect here is missing — the default currency in the workspace. If the default currency is set to MHR, then the total amount did update.

I am not able to recreate this as the expense converts to the home currency of the workspace.

Going to have this retested.

@melvin-bot melvin-bot bot removed the Overdue label Sep 23, 2024
@MelvinBot
Copy link

This has been labelled "Needs Reproduction". Follow the steps here: https://stackoverflowteams.com/c/expensify/questions/16989

@melvin-bot melvin-bot bot added the Overdue label Sep 26, 2024
Copy link

melvin-bot bot commented Sep 27, 2024

@CortneyOfstad Whoops! This issue is 2 days overdue. Let's get this updated quick!

Copy link

melvin-bot bot commented Oct 1, 2024

@CortneyOfstad 6 days overdue. This is scarier than being forced to listen to Vogon poetry!

@CortneyOfstad
Copy link
Contributor

Still waiting for this to be retested!

@melvin-bot melvin-bot bot removed the Overdue label Oct 1, 2024
Copy link

melvin-bot bot commented Oct 3, 2024

@CortneyOfstad this issue was created 2 weeks ago. Are we close to a solution? Let's make sure we're treating this as a top priority. Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!

@melvin-bot melvin-bot bot added the Overdue label Oct 3, 2024
@CortneyOfstad
Copy link
Contributor

Not overdue as waiting for this to be retested!

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Oct 4, 2024
@CortneyOfstad
Copy link
Contributor

Again, still waiting for this to be retested!

@melvin-bot melvin-bot bot removed the Overdue label Oct 8, 2024
@CyberAndrii
Copy link
Contributor

This issue is still reproducible. To clarify as the title is a bit misleading - the total amount does update, but not to the correct value. It should be around 1500 but it's showing as 1212. Refreshing the page displays the correct amount.

@melvin-bot melvin-bot bot added the Overdue label Oct 10, 2024
Copy link

melvin-bot bot commented Oct 11, 2024

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

@CortneyOfstad
Copy link
Contributor

Thanks @CyberAndrii!

Copy link

melvin-bot bot commented Nov 15, 2024

@marcochavezf @CortneyOfstad @huult / @situchan The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]

@CortneyOfstad
Copy link
Contributor

Payment is not due until next week, but in the meantime @situchan — can you confirm if this needs a regression test? Thanks!

@garrettmknight garrettmknight moved this from Bugs and Follow Up Issues to Hold for Payment in [#whatsnext] #expense Nov 19, 2024
@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Nov 22, 2024
@CortneyOfstad
Copy link
Contributor

Payment Summary

@situchan — paid $250 via Upwork
@huult — paid $250 via Upwork

@github-project-automation github-project-automation bot moved this from Hold for Payment to Done in [#whatsnext] #expense Nov 22, 2024
@CortneyOfstad CortneyOfstad reopened this Nov 22, 2024
@CortneyOfstad
Copy link
Contributor

Whoops! Forgot about the checklist! @situchan please complete the checklist below. Thank you!

BugZero Checklist:

  • [Contributor] Classify the bug:
Bug classification

Source of bug:

  • 1a. Result of the original design (eg. a case wasn't considered)
  • 1b. Mistake during implementation
  • 1c. Backend bug
  • 1z. Other:

Where bug was reported:

  • 2a. Reported on production
  • 2b. Reported on staging (deploy blocker)
  • 2c. Reported on both staging and production
  • 2d. Reported on a PR
  • 2z. Other:

Who reported the bug:

  • 3a. Expensify user
  • 3b. Expensify employee
  • 3c. Contributor
  • 3d. QA
  • 3z. Other:
  • [Contributor] 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:

  • [Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source 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:

  • [Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.

Regression Test Proposal Template
  • [BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.

    Link to issue:

Regression Test Proposal

Precondition:

Test:

Do we agree 👍 or 👎

@mvtglobally
Copy link

Issue not reproducible during KI retests. (First week)

@melvin-bot melvin-bot bot added the Overdue label Nov 25, 2024
@luacmartins luacmartins removed the retest-weekly Apply this label if you want this issue tested on a Weekly basis by Applause label Nov 25, 2024
@luacmartins
Copy link
Contributor

The issue was fixed already, it's only open to process the checklist

Copy link

melvin-bot bot commented Nov 26, 2024

@marcochavezf, @CortneyOfstad, @huult, @situchan Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@CortneyOfstad
Copy link
Contributor

@situchan please update the checklist ASAP so this GH can be closed/completed. Thanks!

Copy link

melvin-bot bot commented Nov 28, 2024

@marcochavezf, @CortneyOfstad, @huult, @situchan Huh... This is 4 days overdue. Who can take care of this?

@mvtglobally
Copy link

Issue not reproducible during KI retests. (Second week)

Copy link

melvin-bot bot commented Dec 2, 2024

@marcochavezf, @CortneyOfstad, @huult, @situchan 8 days overdue is a lot. Should this be a Weekly issue? If so, feel free to change it!

@marcochavezf
Copy link
Contributor

Friendly bump @situchan per #49493 (comment)

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Dec 2, 2024
Copy link

melvin-bot bot commented Dec 6, 2024

@marcochavezf, @CortneyOfstad, @huult, @situchan Whoops! This issue is 2 days overdue. Let's get this updated quick!

@CortneyOfstad
Copy link
Contributor

@situchan bump on the comment here.

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Dec 6, 2024
@CortneyOfstad
Copy link
Contributor

@situchan bump please

@melvin-bot melvin-bot bot removed the Overdue label Dec 9, 2024
@CortneyOfstad
Copy link
Contributor

@situchan — please complete this ASAP.

@melvin-bot melvin-bot bot added the Overdue label Dec 16, 2024
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 External Added to denote the issue can be worked on by a contributor Needs Reproduction Reproducible steps needed Overdue
Projects
Status: Done
Development

No branches or pull requests

9 participants