Skip to content

[$250] Dupe detect - Paid expense appears in Review duplicates flow but unable to complete the flow #46372

Closed

Description

@lanitochka17

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.13-3
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail: N/A
Issue reported by: Applause - Internal Team

Action Performed:

  1. Go to staging.new.expensify.com
  2. Go to workspace chat
  3. Submit an expense
  4. Pay the expense
  5. Submit another two same expenses (same amount, date and merchant) as expense from Step 3
  6. Go to transaction thread of any of the submitted expense from Step 5
  7. Click Review duplicates
  8. Click Keep this one on the paid expense (from Step 4)
  9. Click Confirm
  10. Note that the other two expenses are not removed
  11. Go to transaction thread of any of the submitted expense from Step 5
  12. Click Review duplicates
  13. Click Keep this one on any of the unpaid expense (from Step 5)
  14. Click Confirm
  15. Note that the process fails and Review duplicates button reappears

Expected Result:

In Step 8, the paid expense should not appear in Review duplicates flow if we cannot keep only the paid one (Step 10)

Actual Result:

In Step 8, the paid expense appears in Review duplicates flow and we cannot keep only the paid one (Step 10)
We also cannot keep only the unpaid one (Step 15) after attempting to keep only the paid expense

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

Bug6554735_1722091102495.bandicam_2024-07-27_22-29-22-189.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01add0c19e8ce4b462
  • Upwork Job ID: 1817919014389694342
  • Last Price Increase: 2024-08-12
Issue OwnerCurrent Issue Owner: @zanyrenney

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Jul 27, 2024
  2. melvin-bot commented on Jul 27, 2024

    @melvin-bot

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

  3. lanitochka17 commented on Jul 27, 2024

    @lanitochka17
    Author

    We think that this bug might be related to #wave-collect - Release 2

  4. lanitochka17 commented on Jul 27, 2024

    @lanitochka17
    Author

    @zanyrenney 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

  5. nyomanjyotisa commented on Jul 28, 2024

    @nyomanjyotisa
    Member

    Proposal

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

    Paid expense appears in Review duplicates flow but unable to complete the flow

    What is the root cause of that problem?

    Paid duplicates transaction from other reports are included in the transactionViolations onyx data from the API response

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

    We should filter the transactions to show in the Review duplicates page to only show transaction within the current report

    Add the following code here

        const finalTransactions = useMemo(
            () => transactions?.filter((transaction) => report?.chatReportID === transaction?.reportID),
            [transactions, report?.chatReportID]
        );
    
        const finalTransactionIDs = useMemo(
            () => finalTransactions?.map((transaction) => transaction?.transactionID),
            [finalTransactions]
        );
    

    use finalTransactionIDs here

    and use finalTransactions here

    RESULT

    -1-New-Expensify.13.mp4

    What alternative solutions did you explore? (Optional)

  6. daledah commented on Jul 29, 2024

    @daledah
    Contributor

    Edited by proposal-police: This proposal was edited at 2024-08-09 07:00:14 UTC.

    Proposal

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

    In Step 8, the paid expense appears in Review duplicates flow and we cannot keep only the paid one (Step 10)
    We also cannot keep only the unpaid one (Step 15) after attempting to keep only the paid expense

    What is the root cause of that problem?

    In step 8, the list of transactions to display is from:

    const transactionIDs = [transactionID, ...duplicateTransactionIDs];

    where we do not filter out the paid transactions.

    The similar logic appears in:

    const allTransactionIDsDuplicates = [reviewingTransactionID, ...duplicates].filter((id) => id !== transaction?.transactionID);

    const transactions = [transactionID, ...duplicates].map((item) => getTransaction(item));

    const transactionIDs = [transactionID, ...duplicateTransactionIDs];

    transactionIDList: reviewDuplicates?.duplicates ?? [],

    Then, when calling API Transaction_Merge, the transactionIDList includes paid expenses as well.

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

    We should create a function to filter out the paid expense:

    function removeSettledTransactions(transactionIDs: string[]) {
        return transactionIDs.filter((transactionID) => !isSettled(allTransactions?.[`${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`]?.reportID));
    }
    

    then use it in

    const allTransactionIDsDuplicates = [reviewingTransactionID, ...duplicates].filter((id) => id !== transaction?.transactionID);

    const transactions = [transactionID, ...duplicates].map((item) => getTransaction(item));

    transactionIDList: reviewDuplicates?.duplicates ?? [],

    Additional implementation based on new expected behavior in comment:

    We should display a message under the Keep All button indicating that some duplicates have already been approved or reimbursed.

    In there, add:

        const settledTransaction = transactions.find((transaction) => isSettled(transaction?.reportID));
    

    to know whether we have the transactions that have already been approved or reimbursed.

    Then use it to display the text "Some of these duplicates have been approved or paid already":

                        {!!settledTransaction && <View style={[styles.textNormal, styles.colorMuted]}>Some of these duplicates have been approved or paid already</View>}
    
    

    We can't remove the Keep this one button completely as there might be more than one unapproved expense and the user might want to keep one of them.

    We can update it:


    to:

                {isReviewDuplicateTransactionPage && !isSettled (
    
  7. zanyrenney commented on Jul 29, 2024

    @zanyrenney
    Contributor

    adding external and to project

  8. moved this to Release 2: Summer 2024 (Aug) in [#whatsnext] #wave-collecton Jul 29, 2024
  9. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Jul 29, 2024
  10. melvin-bot commented on Jul 29, 2024

    @melvin-bot
  11. changed the title [-]Dupe detect - Paid expense appears in Review duplicates flow but unable to complete the flow[/-] [+][$250] Dupe detect - Paid expense appears in Review duplicates flow but unable to complete the flow[/+] on Jul 29, 2024
  12. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Jul 29, 2024
  13. 89 remaining items

  14. melvin-bot commented on Oct 7, 2024

    @melvin-bot

    @parasharrajat, @techievivek, @zanyrenney, @daledah Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

  15. zanyrenney commented on Oct 8, 2024

    @zanyrenney
    Contributor

    @daledah still hasn't applied to the job,.

  16. daledah commented on Oct 8, 2024

    @daledah
    Contributor

    @zanyrenney When I access the job Upwork says the job is no longer available, can you please create an offer for my account https://www.upwork.com/freelancers/~0138d999529f34d33f

  17. zanyrenney commented on Oct 11, 2024

    @zanyrenney
    Contributor

    Hey @daledah offer sent!!

  18. daledah commented on Oct 11, 2024

    @daledah
    Contributor

    @zanyrenney Thx, I accepted it in Upwork

  19. zanyrenney commented on Oct 14, 2024

    @zanyrenney
    Contributor

    payment summary

    $250 for @parasharrajat can be requested through ND.
    $250 for @daledah needs to be paid through upwork. PAID

  20. moved this from Release 2: Summer 2024 (Aug) to Done in #expensify-bugson Oct 14, 2024
  21. parasharrajat commented on Dec 12, 2024

    @parasharrajat
    Member

    Payment requested as per #46372 (comment)

  22. JmillsExpensify commented on Dec 16, 2024

    @JmillsExpensify
    Contributor

    $250 approved for @parasharrajat

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

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions