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-07-31] [Dupe Detection] Merge Duplicates - Confirm Page #39810

Closed
pecanoro opened this issue Apr 8, 2024 · 20 comments
Closed
Assignees
Labels
Daily KSv2 Engineering NewFeature Something to build that is a new item.

Comments

@pecanoro
Copy link
Contributor

pecanoro commented Apr 8, 2024

Part of the Merge Duplicates project

Main issue: https://github.com/Expensify/Expensify/issues/307591
Doc section: Surfacing Potential Duplicates
Project: [Wave: Collect Approvers] Dupe Detection

Part of a series of issues:

Feature Description

Context for ReviewDuplicates

  • Review page - /r/:threadReportID/duplicates/review
  • Merchant - /r/:threadReportID/duplicates/review/merchant
  • Category - /r/:threadReportID/duplicates/review/category
  • Tag - /r/:threadReportID/duplicates/review/tag
  • Description - /r/:threadReportID/duplicates/review/description
  • Confirm page - /r/:threadReportID/duplicates/confirm

image

All of these screens will exist in their own navigator so they can be pushed (and later popped off once complete) as a group.

All of this will use an Onyx form key of ONYXKEYS.FORMS.REVIEW_DUPLICATES_FORM so we can store the data selected by the user so far when resolving the duplicates. It also lets us keep track of which transaction to keep and which ones are duplicates when the user clicks on Keep this one.

This key will follow a structure like this:

{
  "review_duplicates_form_<transactionID>": [
    {
        "duplicates": {
<transactionID>: <transactionID>,
	...
  },
        "merchant": "...",
        "tag": ...",
	  "description": ...",
			…
    }
  ]
}

Confirm Page

Our last confirm page will show a similar non-editable version of MoneyRequestView:

  • Enable shouldShowOfflineIndicator for the screenwrapper as the command only works online.
  • This view is also a form component but features a green “Confirm” button.
  • onPress, we call an action in actions/IOU.js called mergeDuplicates which calls:
API.write('MergeDuplicates',
{
	transactionID,  // transaction to keep
	transactionIDs, // transactions to delete
       created,
       merchant,
       ...
}:

Some notes about the above request:

  • Since we are using pattern B, we need to set the optimistic and failure data. When we merge two or more transactions, we basically need to get rid of the ones that we don’t want to keep and update the one that we want to keep.

    • Removing the ones that we don’t want to keep works similarly to when we delete a money request, so we will update Onyx data really similarly to what we do here.
    • Additionally, we need to update the transactions_ key in Onyx with the updated fields (merchant, tags, category…) for the transactionID.
    • We also need to update the comment in the transactions_ key in Onyx to remove the duplicate violation violation within the comment.
    • We also need to update the transactionViolations_ key in Onyx to remove the duplicate violation. We’ll update the ViolationUtils.getViolationsOnyxData method that calculates the new transaction violations (by adding/removing those that have been addressed with the current user changes), and returns an object that we can save into Onyx, to work with duplicate violations as well.
  • We will navigate the user directly back to the MoneyRequestView of the expenseReport we were keeping.

Issue OwnerCurrent Issue Owner: @kubabutkiewicz
Copy link

melvin-bot bot commented Apr 8, 2024

@pecanoro
Copy link
Contributor Author

pecanoro commented Apr 17, 2024

Callstack will be taking this series of tasks

@melvin-bot melvin-bot bot removed the Overdue label Apr 17, 2024
@pecanoro pecanoro changed the title [HOLD][Dupe Detection] Merge Duplicates - Confirm Page [Dupe Detection] Merge Duplicates - Confirm Page Apr 17, 2024
@kubabutkiewicz
Copy link
Contributor

Hi, I'm Jakub from Callstack - expert contributor group - and I would like to take a look at this issue.

@kubabutkiewicz
Copy link
Contributor

Hi, just wanted to inform that I will be OOO from 29.04 to 05.05.

@melvin-bot melvin-bot bot added the Overdue label May 6, 2024
@pecanoro
Copy link
Contributor Author

pecanoro commented May 6, 2024

In progress!

@melvin-bot melvin-bot bot removed the Overdue label May 6, 2024
@melvin-bot melvin-bot bot added the Overdue label May 14, 2024
@pecanoro
Copy link
Contributor Author

In progress!

@pecanoro
Copy link
Contributor Author

WIP!

@melvin-bot melvin-bot bot removed the Overdue label May 24, 2024
@melvin-bot melvin-bot bot added the Overdue label Jun 3, 2024
@pecanoro
Copy link
Contributor Author

pecanoro commented Jun 4, 2024

WIP!

@melvin-bot melvin-bot bot removed the Overdue label Jun 4, 2024
@melvin-bot melvin-bot bot removed the Weekly KSv2 label Jun 28, 2024
@melvin-bot melvin-bot bot added the Monthly KSv2 label Jun 28, 2024
Copy link

melvin-bot bot commented Jun 28, 2024

This issue has not been updated in over 15 days. @pecanoro, @kubabutkiewicz 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!

@pecanoro
Copy link
Contributor Author

Still WIP!

@pecanoro pecanoro added Weekly KSv2 and removed Monthly KSv2 labels Jun 28, 2024
@parasharrajat
Copy link
Member

I would like to review this page as well given that I reviewed other two and has more context.

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Weekly KSv2 labels Jul 8, 2024
@kubabutkiewicz
Copy link
Contributor

@parasharrajat @pecanoro @JmillsExpensify PR is ready to review 😄

@trjExpensify
Copy link
Contributor

Did the automation not run here? Seems like it hit prod 3 days ago: #42571 (comment)

@pecanoro
Copy link
Contributor Author

Hmm, yes, I think it failed

@JmillsExpensify JmillsExpensify changed the title [Dupe Detection] Merge Duplicates - Confirm Page [Hold for payment 2024-07-31] [Dupe Detection] Merge Duplicates - Confirm Page Jul 30, 2024
@JmillsExpensify
Copy link

cc @sakluger this is ready for payment soon.

@sakluger
Copy link
Contributor

sakluger commented Aug 9, 2024

Sorry, everyone, I just noticed that this issue slipped through the cracks.

Summarizing payment on this issue:

Contributor: @kubabutkiewicz $250 - contractor, no payment required
Contributor+: @parasharrajat $250, please request on Newdot

@parasharrajat do we need any regression tests for this one? Maybe something similar to the tests laid out in the PR?

@sakluger sakluger added Daily KSv2 and removed Weekly KSv2 Reviewing Has a PR in review labels Aug 9, 2024
@parasharrajat
Copy link
Member

Regression Test Steps

  1. Create some expanses which are duplicates
  2. Go to one of expenses which are duplicates and click Review duplicates button
  3. Next click on one of the Keep this one button
  4. Now if there are some discrepancies between expenses you should be navigated to screen to review those discrepancies
  5. When there are no discrepancies you will be navigated to confirm screen.
  6. Verify that fields on confirmation screen are disabled.
  7. Verify that fields which you selected during review are the same which are on confirmation
  8. Click Confirm and observe that duplicate is resolved.

Do you agree 👍 or 👎 ?

@sakluger
Copy link
Contributor

sakluger commented Aug 12, 2024

Thanks! Those steps are pretty good, I edited them to be a bit more specific.

  1. Create two expenses with duplicate expense details (merchant/date/amount), but different categories and descriptions
  2. Go to one of the duplicate expenses and click the "Review duplicates" button
  3. Click the "Keep this one" button for either copy of the expense
  4. Verify that you are taken to a new "Review duplicates" screen showing both categories
  5. Select one of the categories
  6. Verify that you are taken to a new "Review duplicates" screen showing both expense descriptions
  7. Select one of the descriptions
  8. Verify that you are taken to the "Confirm the details you're keeping" screen, that it shows the same category and description that you selected on the previous two screens, and that all fields are disabled
  9. Click Confirm and verify that the duplicate violation is gone

@parasharrajat
Copy link
Member

Payment requested as per #39810 (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
Daily KSv2 Engineering NewFeature Something to build that is a new item.
Projects
Status: Done
Development

No branches or pull requests

6 participants