Skip to content

[Hold for payment 2024-07-31] [Dupe Detection] Merge Duplicates - Confirm Page #39810

Closed

Description

@pecanoro

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

Activity

  1. self-assigned this
    on Apr 8, 2024
  2. melvin-bot commented on Apr 8, 2024

    @melvin-bot
  3. moved this to Release 2: Summer 2024 (Aug) in [#whatsnext] #wave-collecton Apr 8, 2024
  4. pecanoro commented on Apr 17, 2024

    @pecanoro
    ContributorAuthor

    Callstack will be taking this series of tasks

  5. changed the title [-][HOLD][Dupe Detection] Merge Duplicates - Confirm Page[/-] [+][Dupe Detection] Merge Duplicates - Confirm Page[/+] on Apr 17, 2024
  6. kubabutkiewicz commented on Apr 22, 2024

    @kubabutkiewicz
    Contributor

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

  7. 27 remaining items

  8. trjExpensify commented on Jul 26, 2024

    @trjExpensify
    Contributor

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

  9. pecanoro commented on Jul 26, 2024

    @pecanoro
    ContributorAuthor

    Hmm, yes, I think it failed

  10. changed the title [-][Dupe Detection] Merge Duplicates - Confirm Page[/-] [+][Hold for payment 2024-07-31] [Dupe Detection] Merge Duplicates - Confirm Page[/+] on Jul 30, 2024
  11. JmillsExpensify commented on Jul 30, 2024

    @JmillsExpensify
    Contributor

    cc @sakluger this is ready for payment soon.

  12. sakluger commented on Aug 9, 2024

    @sakluger
    Contributor

    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?

  13. added and removed
    ReviewingHas a PR in review
    on Aug 9, 2024
  14. parasharrajat commented on Aug 9, 2024

    @parasharrajat
    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 👎 ?

  15. sakluger commented on Aug 12, 2024

    @sakluger
    Contributor

    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
  16. parasharrajat commented on Aug 30, 2024

    @parasharrajat
    Member

    Payment requested as per #39810 (comment)

  17. JmillsExpensify commented on Sep 2, 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

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions