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 2025-01-15] [$250] Group Chat - Error displayed for Split, Distance expenses created with specific currencies #52310

Closed
1 of 8 tasks
m-natarajan opened this issue Nov 11, 2024 · 53 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

Comments

@m-natarajan
Copy link

m-natarajan commented Nov 11, 2024

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.59-3
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught on HybridApp, is this reproducible on New Expensify Standalone?:
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: @jacobkim9881
Slack conversation (hyperlinked to channel name): ts_external_expensify_open_source

Action Performed:

Prerequisite: Default currency in Korean Won

  1. Create a group chat
  2. Click the + in composer and select split expense
  3. Select Distance and enter address for Start and Stop field
  4. Click Next

Expected Result:

Amount equally split and user able to click split button to submit the expense

Actual Result:

The sum of splits must equal the total amount error message displayed and split button non functional

Workaround:

Unknown

Platforms:

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

  • Android: Standalone
  • Android: HybridApp
  • Android: mWeb Chrome
  • iOS: Standalone
  • iOS: HybridApp
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence
2024-11-08.7.14.00.mov

Full Screen #36

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021861139216888650784
  • Upwork Job ID: 1861139216888650784
  • Last Price Increase: 2024-12-09
  • Automatic offers:
    • mkzie2 | Contributor | 105275673
    • shubham1206agra | Contributor | 105579241
Issue OwnerCurrent Issue Owner: @OfstadC
@m-natarajan m-natarajan added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Nov 11, 2024
Copy link

melvin-bot bot commented Nov 11, 2024

Triggered auto assignment to @OfstadC (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.

@jacobkim9881
Copy link
Contributor

I found there is a difference between total amount and split shares:

transaction: 
Object
amount: 519357        /////// not rounded
attendees: [Object] (1)
billable: false
category: ""
comment: {waypoints: Object, customUnit: {customUnitRateID: "_FAKE_P2P_ID_", quantity: 4281.895}, isLoading: false}
created: "2024-11-12"
currency: "KRW"
errorFields: {}
iouRequestType: "distance"
isFromGlobalCreate: false
merchant: "4.28 km @ ₩1213.45 / km"
participants: [{accountID: 18602521, selected: true}] (1)
participantsAutoAssigned: true
pendingFields: {}
reportID: "4715962770440927"
routes: {route0: Object}
shouldShowOriginalAmount: false
splitPayerAccountIDs: [18608989] (1)
splitShares: Object
/////////////// rounded here below
18602521: {amount: 259700, isModified: false}
18608989: {amount: 259700, isModified: false}
Object 견본
transactionID: "1"

const {unit, rate} = mileageRate ?? {};
const distance = TransactionUtils.getDistanceInMeters(transaction, unit);
const currency = mileageRate?.currency ?? policyCurrency;
const amount = DistanceRequestUtils.getDistanceRequestAmount(distance, unit ?? CONST.CUSTOM_UNITS.DISTANCE_UNIT_MILES, rate ?? 0);
IOU.setMoneyRequestAmount(transactionID, amount, currency);
const participantAccountIDs: number[] | undefined = participants?.map((participant) => Number(participant.accountID ?? -1));
if (isSplitRequest && amount && currency && !isPolicyExpenseChat) {
IOU.setSplitShares(transaction, amount, currency ?? '', participantAccountIDs ?? []);
}

There is code for decision how the total is same with split shares. I tried to round total amount from 519357 to 519400. For this calculation, round method is needed but needed parameter currency above always be undefined. Why mileageRate?.currency, policyCurrency are undefined? I am tracing the reason.

@mkzie2
Copy link
Contributor

mkzie2 commented Nov 12, 2024

Proposal

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

The sum of splits must equal the total amount error message displayed and split button non functional

What is the root cause of that problem?

The total amount is calculated by calculateAmount function

const splitAmount = IOUUtils.calculateAmount(participantsLength, amount, currency, isPayer);

The total amount of the split bill is rounded before we calculate the split amount

const totalInCurrencySubunit = Math.round((total / 100) * currencyUnit);

then if the rounded total amount is different from the current amount, the error appears here

if (sumOfShares !== iouAmount) {
setFormError('iou.error.invalidSplit');
return;

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

When calculating the split amount, we should remove the Math.round here so that we do not round the total amount but only the split amount.

const totalInCurrencySubunit = (total / 100) * currencyUnit;

const totalInCurrencySubunit = Math.round((total / 100) * currencyUnit);

What alternative solutions did you explore? (Optional)

@OfstadC
Copy link
Contributor

OfstadC commented Nov 12, 2024

Can confirm
image

But this only happens for this currency - I tried two other currencies and did not get the same response. So not sure how high priority this will be. It's likely uncommon to split a mileage expense, and this would only affect a subset of users
image

@mkzie2
Copy link
Contributor

mkzie2 commented Nov 13, 2024

@OfstadC This bug also happens for some other currencies like VND.

@OfstadC
Copy link
Contributor

OfstadC commented Nov 13, 2024

Added to Quality and posted in Slack for prioritization

@tgolen
Copy link
Contributor

tgolen commented Nov 13, 2024

Does this only affect distance expenses, or does it happen to any split?

@mkzie2
Copy link
Contributor

mkzie2 commented Nov 14, 2024

This only affects distance expense, the reason is the rate is odd.

@OfstadC
Copy link
Contributor

OfstadC commented Nov 14, 2024

Will test this a bit more first thing tomorrow morning - had a managed customer issue that threw my day off today 😓

@OfstadC
Copy link
Contributor

OfstadC commented Nov 15, 2024

Can confirm it does not affect regular splits - just distance. But for the life of me I cannot remember how to change the currency on a distance expense in ND 🤦‍♀️ So working on that now 😅

@OfstadC
Copy link
Contributor

OfstadC commented Nov 15, 2024

Figured the currency out - so ignore me lol. Testing them now

@OfstadC
Copy link
Contributor

OfstadC commented Nov 15, 2024

@mkzie2 I couldn't reproduce with VND - Or other currencies with 'decimals' => 0, I tested about 20 currencies all together🤔

@melvin-bot melvin-bot bot added the Overdue label Nov 18, 2024
@OfstadC
Copy link
Contributor

OfstadC commented Nov 18, 2024

@mkzie2 are you still able to reproduce with other currencies? 🤔

@melvin-bot melvin-bot bot removed the Overdue label Nov 18, 2024
@mkzie2
Copy link
Contributor

mkzie2 commented Nov 19, 2024

@OfstadC Yes I can, an example for VND.

Screen.Recording.2024-11-19.at.17.27.52.mov

@OfstadC
Copy link
Contributor

OfstadC commented Nov 20, 2024

Thanks @mkzie2 - i'm going to have to try this again 🤔

@OfstadC
Copy link
Contributor

OfstadC commented Nov 22, 2024

I'm still having issues 🤔 .

@melvin-bot melvin-bot bot added the Overdue label Nov 25, 2024
Copy link

melvin-bot bot commented Nov 25, 2024

@OfstadC 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!

@OfstadC
Copy link
Contributor

OfstadC commented Nov 25, 2024

Ah - so this does not happen in a workspace chat - only a group DM

image image

@melvin-bot melvin-bot bot removed the Overdue label Nov 25, 2024
@OfstadC
Copy link
Contributor

OfstadC commented Nov 25, 2024

Tested another handful in the group chat - not workspace chat 😅 :

Error occurs on these currencies:
ALL, AFN, BIF, CLP

Does not occur for:
AMD, ANG, CAD, CUP

So I believe the theory that it occurs for Currencies where 'decimals' => 0, is listed - is accurate.

@OfstadC OfstadC changed the title Error message displayed for split distance created in Korean Won currency Group Chat - Error displayed for Split, Distance expenses created with specific currencies Nov 25, 2024
@OfstadC OfstadC added the External Added to denote the issue can be worked on by a contributor label Nov 25, 2024
@melvin-bot melvin-bot bot changed the title Group Chat - Error displayed for Split, Distance expenses created with specific currencies [$250] Group Chat - Error displayed for Split, Distance expenses created with specific currencies Nov 25, 2024
Copy link

melvin-bot bot commented Jan 6, 2025

This issue has not been updated in over 15 days. @arosiclair, @OfstadC, @rushatgabhane, @mkzie2 eroding to Monthly issue.

P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do!

Copy link

melvin-bot bot commented Jan 6, 2025

📣 @shubham1206agra 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job
Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
Keep in mind: Code of Conduct | Contributing 📖

@arosiclair
Copy link
Contributor

@rushatgabhane has been inactive for the last few weeks so assigned @shubham1206agra as the C+ here

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Monthly KSv2 labels Jan 8, 2025
@melvin-bot melvin-bot bot changed the title [$250] Group Chat - Error displayed for Split, Distance expenses created with specific currencies [HOLD for payment 2025-01-15] [$250] Group Chat - Error displayed for Split, Distance expenses created with specific currencies Jan 8, 2025
Copy link

melvin-bot bot commented Jan 8, 2025

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

@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Jan 8, 2025
Copy link

melvin-bot bot commented Jan 8, 2025

The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.81-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 2025-01-15. 🎊

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

Copy link

melvin-bot bot commented Jan 8, 2025

@shubham1206agra @OfstadC @shubham1206agra 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]

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Jan 14, 2025
@OfstadC
Copy link
Contributor

OfstadC commented Jan 15, 2025

@jacobkim9881 Could you please share your Upwork Profile link? Thanks!

@shubham1206agra Please complete BZ checklist by EOD

@shubham1206agra
Copy link
Contributor

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 (eg. bug slipped through the normal regression and PR testing process on staging)
  • 2b. Reported on staging (eg. found during regression or PR testing)
  • 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: https://github.com/Expensify/App/pull/24175/files#r1916977333

  • [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: Not Required

  • [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.

  • [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:

  • Setting the default currency to one of them: ALL, AFN, BIF, CLP, VND

Test:

  1. Create a group chat
  2. Go to group chat > FAB > Split expense > Distance
  3. Enter the address for the Start and Stop field
  4. Click next
  5. Verify that no The sum of splits must equal the total amount error

Do we agree 👍 or 👎

@shubham1206agra
Copy link
Contributor

@OfstadC Offer accepted

@jacobkim9881
Copy link
Contributor

@shubham1206agra
Copy link
Contributor

@OfstadC Why @jacobkim9881 needs to be paid here?

@mkzie2
Copy link
Contributor

mkzie2 commented Jan 16, 2025

@OfstadC Maybe a mistake, I should be paid here.

@jacobkim9881
Copy link
Contributor

I thought I would be paid for reporting an issue.

@OfstadC
Copy link
Contributor

OfstadC commented Jan 16, 2025

@shubham1206agra

I was going off of this. Is this not correct?

CC @arosiclair

@shubham1206agra
Copy link
Contributor

Nope
Only me and @mkzie2 needs to be paid here

@jacobkim9881
Copy link
Contributor

@arosiclair
Copy link
Contributor

IIRC, there is no bonus for reporting bugs at the moment

@OfstadC
Copy link
Contributor

OfstadC commented Jan 17, 2025

Thanks for confirming @arosiclair @shubham1206agra !

Sorry for causing some confusion here 😅

Payment Summary

@OfstadC OfstadC closed this as completed Jan 17, 2025
@github-project-automation github-project-automation bot moved this from MEDIUM to Done in [#whatsnext] #quality Jan 17, 2025
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
Projects
Status: Done
Development

No branches or pull requests

8 participants