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

[$250] Duplicate system message when resolving duplicates selecting "Keep all" #51493

Open
1 of 8 tasks
m-natarajan opened this issue Oct 25, 2024 · 12 comments
Open
1 of 8 tasks
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors

Comments

@m-natarajan
Copy link

m-natarajan commented Oct 25, 2024

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.54-1
Reproducible in staging?: y
Reproducible in production?: y
If this was caught on HybridApp, is this reproducible on New Expensify Standalone?:
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by: @JmillsExpensify
Slack conversation: https://expensify.slack.com/archives/C05LX9D6E07/p1729791374775059

Action Performed:

  1. Create a workspace as user A
  2. Add user B to the workspace
  3. Submit duplicate expenses to the workspace
  4. As user A resolve the duplicate expenses by selecting "Keep all"

Expected Result:

Only one system message "resolved the duplicate" appears

Actual Result:

Duplicate resolved the duplicate message appears

Workaround:

unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android: Standalone
  • Android: HybridApp
  • Android: mWeb Chrome
  • iOS: Standalone
  • iOS: HybridApp
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence
Recording.703.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021849911355476934677
  • Upwork Job ID: 1849911355476934677
  • Last Price Increase: 2024-10-25
@m-natarajan m-natarajan added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Oct 25, 2024
Copy link

melvin-bot bot commented Oct 25, 2024

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

@JmillsExpensify JmillsExpensify added the External Added to denote the issue can be worked on by a contributor label Oct 25, 2024
@melvin-bot melvin-bot bot changed the title Duplicate system message when resolving duplicates selecting "Keep all" [$250] Duplicate system message when resolving duplicates selecting "Keep all" Oct 25, 2024
Copy link

melvin-bot bot commented Oct 25, 2024

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

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Oct 25, 2024
Copy link

melvin-bot bot commented Oct 25, 2024

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

@JmillsExpensify
Copy link

Opening up to the community to see if we can get this long-standing bug fixed.

@ranli
Copy link

ranli commented Oct 27, 2024

Edited by proposal-police: This proposal was edited at 2024-10-28 07:23:31 UTC.

Proposal

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

Duplicate system message("resolved the duplicate") when resolving duplicates selecting "Keep all"

What is the root cause of that problem?

In src/libs/actions/Transaction.ts file, dismissDuplicateTransactionViolation() function keeps adding same reporting actions whenever user review and select "keep all" a new submitted duplicate expense. This is because we are using${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${action?.childReportID ?? '-1'} as the key, so same action get added everytime.

  const optimisticReportActions: OnyxUpdate[] = transactionsReportActions.map((action, index) => ({
      onyxMethod: Onyx.METHOD.MERGE,
      key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${action?.childReportID ?? '-1'}`,
      value: {
          [optimisticDissmidedViolationReportActions.at(index)?.reportActionID ?? '']: optimisticDissmidedViolationReportActions.at(index) as ReportAction,
      },
  }));

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

Append the violation type to the key, so the same violation wont be added twice.

const optimisticReportActions: OnyxUpdate[] = transactionsReportActions.map((action, index) => ({
    onyxMethod: Onyx.METHOD.MERGE,
    key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${action?.childReportID ?? '-1'}_${CONST.VIOLATIONS.DUPLICATED_TRANSACTION}`,
    value: {
        [optimisticDissmidedViolationReportActions.at(index)?.reportActionID ?? '']: optimisticDissmidedViolationReportActions.at(index) as ReportAction,
    },
}));
....
const failureReportActions: OnyxUpdate[] = transactionsReportActions.map((action, index) => ({
    onyxMethod: Onyx.METHOD.MERGE,
    key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${action?.childReportID ?? '-1'}_${CONST.VIOLATIONS.DUPLICATED_TRANSACTION}`,
    value: {
        [optimisticDissmidedViolationReportActions.at(index)?.reportActionID ?? '']: null,
    },
}));
...
const successData: OnyxUpdate[] = transactionsReportActions.map((action, index) => ({
    onyxMethod: Onyx.METHOD.MERGE,
    key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${action?.childReportID ?? '-1'}_${CONST.VIOLATIONS.DUPLICATED_TRANSACTION}`,
    value: {
        [optimisticDissmidedViolationReportActions.at(index)?.reportActionID ?? '']: {
            pendingAction: null,
        },
    },
}));

...

What alternative solutions did you explore? (Optional)

  1. Add a attribute the report action type, so that we can use a dynamic value as the key. This will impact many places, as report action is used by many other components. regression may happen.
  2. Filter the action at view level (ReportActionItem component). This component has many business logic, filtering may also cause regression.

Contributor details

Your Expensify account email: ranli.ryan@gmail.com
Upwork Profile Link: https://www.upwork.com/freelancers/~0184337af0a7f3752b

Copy link

melvin-bot bot commented Oct 27, 2024

⚠️ Missing/invalid email or upwork profile link. Please make sure you add both your Expensify email and Upwork profile link in the format specified.

@ranli
Copy link

ranli commented Oct 27, 2024

Contributor details
Your Expensify account email: ranli.ryan@gmail.com
Upwork Profile Link: https://www.upwork.com/freelancers/~0184337af0a7f3752b

Copy link

melvin-bot bot commented Oct 27, 2024

⚠️ Missing/invalid email or upwork profile link. Please make sure you add both your Expensify email and Upwork profile link in the format specified.

@ranli
Copy link

ranli commented Oct 27, 2024

Contributor details
Your Expensify account email: ranli.ryan@gmail.com
Upwork Profile Link: https://www.upwork.com/freelancers/~0184337af0a7f3752b

Copy link

melvin-bot bot commented Oct 27, 2024

✅ Contributor details stored successfully. Thank you for contributing to Expensify!

@melvin-bot melvin-bot bot added the Overdue label Oct 28, 2024
@sakluger
Copy link
Contributor

Not overdue - we just got a new proposal yesterday.

@melvin-bot melvin-bot bot removed the Overdue label Oct 28, 2024
@ZhenjaHorbach
Copy link
Contributor

@ranli
Thanks for your proposal !
I will check tomorrow !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors
Projects
None yet
Development

No branches or pull requests

5 participants