Skip to content

[$250] [P2P Distance] Split - Incorrect amount & distance behavior when changing distance on confirm page offline #47048

Closed

Description

@IuliiaHerets

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

Action Performed:

  1. Go to staging.new.expensify.com
  2. Go to group chat.
  3. Click + > Split expense > Distance.
  4. Enter waypoints > Next.
  5. On confirmation page, go offline.
  6. Click Distance.
  7. Change distance by swapping position and save it.

Expected Result:

  • Amount field will be empty.
  • Distance field will change to Pending.
  • Split input will be 0.00.

Actual Result:

Amount, Distance and split inputs change to a very big value.

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

Bug6565228_1723089231018.20240808_114732.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~016482e5c32e2edfad
  • Upwork Job ID: 1823019084308686776
  • Last Price Increase: 2024-09-02
Issue OwnerCurrent Issue Owner: @carlosmiceli

Activity

  1. added
    DeployBlockerCashThis issue or pull request should block deployment
    BugSomething is broken. Auto assigns a BugZero manager.
    DeployBlockerIndicates it should block deploying the API
    on Aug 8, 2024
  2. melvin-bot commented on Aug 8, 2024

    @melvin-bot

    Triggered auto assignment to @Julesssss (DeployBlockerCash), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.

  3. melvin-bot commented on Aug 8, 2024

    @melvin-bot

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

  4. IuliiaHerets commented on Aug 8, 2024

    @IuliiaHerets
    Author

    We think that this bug might be related to #vip-split

  5. github-actions commented on Aug 8, 2024

    @github-actions
    Contributor

    👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

    1. Identify the pull request that introduced this issue and revert it.
    2. Find someone who can quickly fix the issue.
    3. Fix the issue yourself.
  6. bernhardoj commented on Aug 8, 2024

    @bernhardoj
    Contributor

    Proposal

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

    The distance, amount, and individual split share changes to a very big value.

    What is the root cause of that problem?

    From the expected result, the 1st (Amount field will be empty) and 2nd problem (Distance field will change to Pending) is the same root cause as #46952 and is currently being handled in #46964.

    For the 3rd problem (Split input will be 0.00), even after we fix the 1st and 2nd, the split amount still won't be 0 when the distance amount is 0 because we only update the individual split amount if the distance amount (amount) is truth (> 0).

    const participantAccountIDs: number[] = selectedParticipantsProp.map((participant) => participant.accountID ?? -1);
    if (isTypeSplit && !isPolicyExpenseChat && amount && transaction?.currency) {
    IOU.setSplitShares(transaction, amount, currency, participantAccountIDs);
    }

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

    If we want to update the individual split amount to 0 when the distance amount is 0, then we need to remove the amount check here.

    const participantAccountIDs: number[] = selectedParticipantsProp.map((participant) => participant.accountID ?? -1);
    if (isTypeSplit && !isPolicyExpenseChat && amount && transaction?.currency) {
    IOU.setSplitShares(transaction, amount, currency, participantAccountIDs);
    }

    However, I notice that when we create the split distance while offline with the pending distance, the request will always fail and also, the participant is only the current user because we don't include participants with 0 split amount.

    const splits: Split[] = [{email: currentUserEmailForIOUSplit, accountID: currentUserAccountID, amount: currentUserAmount, taxAmount: currentUserTaxAmount}];

    let splitParticipants = selectedParticipants;
    // Filter out participants with an amount equal to O
    if (iouType === CONST.IOU.TYPE.SPLIT && transaction?.splitShares) {
    const participantsWithAmount = Object.keys(transaction.splitShares ?? {})
    .filter((accountID: string): boolean => (transaction?.splitShares?.[Number(accountID)]?.amount ?? 0) > 0)
    .map((accountID) => Number(accountID));
    splitParticipants = selectedParticipants.filter((participant) =>
    participantsWithAmount.includes(participant.isPolicyExpenseChat ? participant?.ownerAccountID ?? -1 : participant.accountID ?? -1),
    );
    }

    App/src/libs/actions/IOU.ts

    Lines 4062 to 4066 in 9c7c4a1

    // To exclude someone from a split, the amount can be 0. The scenario for this is when creating a split from a group chat, we have remove the option to deselect users to exclude them.
    // We can input '0' next to someone we want to exclude.
    if (splitAmount === 0) {
    return;
    }

    I tried to always include the participant even when the amount is 0, but it still fails.

    Maybe we can disable the confirmation button if the distance amount is 0.

  7. Julesssss commented on Aug 8, 2024

    @Julesssss
    Contributor

    Not treating this as a blocker. While annoying it should be rare and has an obvious workaround.

  8. 62 remaining items

  9. neil-marcellini commented on Sep 19, 2024

    @neil-marcellini
    Contributor

    @neil-marcellini How do I get location working? I already gave access.

    Screenshot 2024-09-18 at 4 02 46 PM

    That's odd, might be a separate bug. Try reloading the page, signing out and back in, etc. If you still have trouble you can start looking into the MapView and how it's loaded, how the token is fetched.

    I just tried and found out that GetMapboxAccessToken is failing because we removed the token and haven't sent an action required email yet. I explained the solution here.

  10. melvin-bot commented on Sep 24, 2024

    @melvin-bot

    @carlosmiceli, @greg-schroeder, @fedirjh Huh... This is 4 days overdue. Who can take care of this?

  11. carlosmiceli commented on Sep 25, 2024

    @carlosmiceli
    Contributor

    Was OOO, will try to work on it this week after I deal with some backlog.

  12. greg-schroeder commented on Sep 27, 2024

    @greg-schroeder
    Contributor

    Okay Thanks @carlosmiceli!

  13. carlosmiceli commented on Sep 30, 2024

    @carlosmiceli
    Contributor

    Got carried away with wrapping homepage phase 2 issues, should be able to start this week 🙏

  14. greg-schroeder commented on Oct 1, 2024

    @greg-schroeder
    Contributor

    Closing as #vip-split is now closed/archived/paused - let me know if you disagree @carlosmiceli

    context: https://expensify.slack.com/archives/C05RECHFBEW/p1727723167802139

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugSomething is broken. Auto assigns a BugZero manager.EngineeringImprovementItem broken or needs improvement.InternalRequires API changes or must be handled by Expensify staffWeeklyKSv2

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions