Skip to content

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

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

Closed
6 tasks done
lanitochka17 opened this issue Jul 27, 2024 · 85 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

@lanitochka17
Copy link

lanitochka17 commented Jul 27, 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.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
@lanitochka17 lanitochka17 added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Jul 27, 2024
Copy link

melvin-bot bot commented Jul 27, 2024

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.

@lanitochka17
Copy link
Author

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

@lanitochka17
Copy link
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

@nyomanjyotisa
Copy link
Contributor

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)

@daledah
Copy link
Contributor

daledah commented Jul 29, 2024

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 (

@zanyrenney
Copy link
Contributor

adding external and to project

@zanyrenney zanyrenney moved this to Release 2: Summer 2024 (Aug) in [#whatsnext] #wave-collect Jul 29, 2024
@zanyrenney zanyrenney added the External Added to denote the issue can be worked on by a contributor label Jul 29, 2024
Copy link

melvin-bot bot commented Jul 29, 2024

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

@melvin-bot melvin-bot bot 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 Jul 29, 2024
@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Jul 29, 2024
Copy link

melvin-bot bot commented Jul 29, 2024

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

@zanyrenney
Copy link
Contributor

Hey there @parasharrajat please can you review the proposals above and let me know if we can move forward with either of these.

@parasharrajat
Copy link
Member

Let me check.

@parasharrajat
Copy link
Member

May be a backend issue. Let me get some clarifications.

@parasharrajat
Copy link
Member

OK so the approved and paid expenses should not come in the duplicate violations. I think it is backend issue if backend is sending those.
🎀 👀 🎀 C+ reviewed

Copy link

melvin-bot bot commented Aug 1, 2024

Triggered auto assignment to @techievivek, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

@parasharrajat
Copy link
Member

@techievivek Could you please check if backend needs to be fixed here?

@techievivek
Copy link
Contributor

Looks like we are returning transactions from other reports as well.

@melvin-bot melvin-bot bot added the Overdue label Aug 5, 2024
@techievivek
Copy link
Contributor

@cead22 @pecanoro, Looking for some help here. Are transactions from other reports expected to show up on the review duplicates page?

@techievivek
Copy link
Contributor

Not overdue, already commented above.

@melvin-bot melvin-bot bot removed the Overdue label Aug 5, 2024
@parasharrajat
Copy link
Member

OK. Got it. Thanks for the clarification. @daledah, it looks like there is a small divergence from what we implemented on the PR.

Could you please hide keep this one button when there are any paid expenses in the duplicate? Thus only keep All will function.

@parasharrajat
Copy link
Member

@pecanoro I believe we should be doing the same for approved expenses as well. Correct?

@pecanoro
Copy link
Contributor

Yes, approved and paid!

@dylanexpensify
Copy link
Contributor

@daledah bump on this:

OK. Got it. Thanks for the clarification. @daledah, it looks like there is a small divergence from what we implemented on the PR.

Could you please hide keep this one button when there are any paid expenses in the duplicate? Thus only keep All will function.

@parasharrajat
Copy link
Member

PR is merged

@techievivek
Copy link
Contributor

It has been more than 2 weeks since the PR has hit production. I think we can move with the payment here. cc @zanyrenney, thanks.

@parasharrajat
Copy link
Member

@zanyrenney Bump...Could you please post the summary?

@pecanoro pecanoro added Daily KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 Reviewing Has a PR in review labels Oct 3, 2024
@zanyrenney
Copy link
Contributor

Seems like the automation is still failing.

@zanyrenney
Copy link
Contributor

payment summary

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

@daledah can you apply to the job please?

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

melvin-bot bot commented Oct 7, 2024

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

@zanyrenney
Copy link
Contributor

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

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

daledah commented Oct 8, 2024

@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

@melvin-bot melvin-bot bot added Daily KSv2 and removed Daily KSv2 labels Oct 10, 2024
@zanyrenney
Copy link
Contributor

Hey @daledah offer sent!!

@daledah
Copy link
Contributor

daledah commented Oct 11, 2024

@zanyrenney Thx, I accepted it in Upwork

@melvin-bot melvin-bot bot added the Overdue label Oct 14, 2024
@zanyrenney
Copy link
Contributor

payment summary

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

@melvin-bot melvin-bot bot removed the Overdue label Oct 14, 2024
@github-project-automation github-project-automation bot moved this from Release 2: Summer 2024 (Aug) to Done in #expensify-bugs Oct 14, 2024
@parasharrajat
Copy link
Member

Payment requested as per #46372 (comment)

@JmillsExpensify
Copy link

$250 approved for @parasharrajat

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
Archived in project
Development

No branches or pull requests

10 participants