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] RBR displayed for approver for pending card transaction with violation #54461

Open
1 of 8 tasks
m-natarajan opened this issue Dec 23, 2024 · 8 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 Dec 23, 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:
Reproducible in staging?: Needs Reproduction
Reproducible in production?: Needs Reproduction
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: @quinthar
Slack conversation (hyperlinked to channel name): expense

Action Performed:

  1. Pending card transaction with receipt required violation submitted to approver
  2. Open the report as approver

Expected Result:

No RBR for approver and not prior to the transaction in posting status

Actual Result:

RBR displayed for approver

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

image

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021871679475265597128
  • Upwork Job ID: 1871679475265597128
  • Last Price Increase: 2024-12-24
Issue OwnerCurrent Issue Owner: @jjcoffee
@m-natarajan m-natarajan added Daily KSv2 Needs Reproduction Reproducible steps needed Bug Something is broken. Auto assigns a BugZero manager. labels Dec 23, 2024
@MelvinBot
Copy link

This has been labelled "Needs Reproduction". Follow the steps here: https://stackoverflowteams.com/c/expensify/questions/16989

Copy link

melvin-bot bot commented Dec 23, 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.

@DylanDylann
Copy link
Contributor

I can reproduce this bug. The steps are the same like OP

Screenshot 2024-12-23 at 21 28 44

@garrettmknight garrettmknight moved this to Bugs and Follow Up Issues in [#whatsnext] #expense Dec 23, 2024
@sakluger sakluger added the External Added to denote the issue can be worked on by a contributor label Dec 24, 2024
@melvin-bot melvin-bot bot changed the title RBR displayed for approver for pending card transaction with violation [$250] RBR displayed for approver for pending card transaction with violation Dec 24, 2024
Copy link

melvin-bot bot commented Dec 24, 2024

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

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

melvin-bot bot commented Dec 24, 2024

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

@sakluger
Copy link
Contributor

Thanks @DylanDylann!

@sakluger sakluger removed the Needs Reproduction Reproducible steps needed label Dec 24, 2024
@cretadn22
Copy link
Contributor

Proposal

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

RBR displayed for approver for pending card transaction with violation

What is the root cause of that problem?

The RBR is displayed because the report contains violations

if (ReportUtils.shouldDisplayViolationsRBRInLHN(report, transactionViolations)) {
return {
reason: CONST.RBR_REASONS.HAS_TRANSACTION_THREAD_VIOLATIONS,
};
}
if (hasErrors) {
return {
reason: CONST.RBR_REASONS.HAS_ERRORS,
reportAction,
};
}
if (hasViolations) {
return {
reason: CONST.RBR_REASONS.HAS_VIOLATIONS,
};
}
return null;
}

and this also applies to the report preview

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

In TransactionUtils.hasViolation, TransactionUtils.hasWarningTypeViolation, and TransactionUtils.hasNoticeTypeViolation, we need to add a check to ignore violations if the transaction is a pending card transaction.

To preserve the current behavior elsewhere, we should introduce a new parameter, shouldHideViolationInPendingCardTransaction. This parameter will only be set to true where necessary, ensuring that existing functionality remains unaffected.

If (shouldHideViolationInPendingCardTransacrtion) {  
    const transaction = getTransaction(transactionID);
    if (isExpensifyCardTransaction(transaction) && isPending(transaction)) {
        return false;
    }
}

The same logic should also be applied to ReportUtils.hasReportViolations

What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

We need to create unit tests for the following functions: TransactionUtils.hasViolation, TransactionUtils.hasWarningTypeViolation, and TransactionUtils.hasNoticeTypeViolation. The tests should verify that if there is a pending card transaction and shouldHideViolationInPendingCardTransaction is set to true, these functions return false.

What alternative solutions did you explore? (Optional)

@cretadn22
Copy link
Contributor

With my solution, the RBR will be hidden, but the GBR will still be displayed. We have already created another PR to hide the GBR if all transactions are pending card transactions.

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
Status: Bugs and Follow Up Issues
Development

No branches or pull requests

6 participants