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-26] [$250] Putting an expense on hold causes the Duplicate message to show in the transaction preview #44509

Closed
6 tasks done
m-natarajan opened this issue Jun 26, 2024 · 51 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

@m-natarajan
Copy link

m-natarajan commented Jun 26, 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.2-0
Reproducible in staging?: y
Reproducible in production?: y
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/C049HHMV9SM/p1719073168627369

Action Performed:

Have user A submit several expenses to user B on a Collect workspace
As user B, manually hold one of the expenses which is also a duplicate expense

Expected Result:

The dot separator pattern shows Hold

Actual Result:

The dot separator pattern shows Duplicate

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

image (35)

CleanShot 2024-06-22 at 10 15 17@2x

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01f36e776d0a6fafaa
  • Upwork Job ID: 1806349811933483381
  • Last Price Increase: 2024-07-04
  • Automatic offers:
    • DylanDylann | Contributor | 103047266
Issue OwnerCurrent Issue Owner: @joekaufmanexpensify
@m-natarajan m-natarajan added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Jun 26, 2024
Copy link

melvin-bot bot commented Jun 26, 2024

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

@bernhardoj
Copy link
Contributor

Proposal

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

A duplicate and hold expense shows duplicate in the money request preview header.

What is the root cause of that problem?

When showing the violation, we only take the first violation.

const violations = TransactionUtils.getTransactionViolations(transaction.transactionID, transactionViolations);
if (violations?.[0]) {
const violationMessage = ViolationsUtils.getViolationTranslation(violations[0], translate);
const violationsCount = violations.filter((v) => v.type === CONST.VIOLATION_TYPES.VIOLATION).length;
const isTooLong = violationsCount > 1 || violationMessage.length > 15;
const hasViolationsAndFieldErrors = violationsCount > 0 && hasFieldErrors;
return `${message} ${CONST.DOT_SEPARATOR} ${isTooLong || hasViolationsAndFieldErrors ? translate('violations.reviewRequired') : violationMessage}`;
}

If we have duplicated and hold, the violation array is: [duplicated, hold], that's why the duplicated is shown instead of hold.

We previously prioritized hold in this PR, but was reverted because it caused double Hold to show up. It's because we append the violation message (that contains hold) with another hold text. But it's not guaranteed that the hold violation is always at the first item of the violations.

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

If we want the hold to be prioritized over other violations, then we can set the violationMessage to hold if shouldShowHoldMessage is true.

if (violations?.[0]) {
const violationMessage = ViolationsUtils.getViolationTranslation(violations[0], translate);

const violationMessage = shouldShowHoldMessage ? translate('violations.hold') : ViolationsUtils.getViolationTranslation(violations[0], translate);

OR

Sort the violations array which puts hold violation at the first item of the array.

const violations = TransactionUtils.getTransactionViolations(transaction.transactionID, transactionViolations)?.sort((violation1, violation2) => {
    if (violation1.name === 'hold') {
        return -1;
    }
    if (violation2.name === 'hold') {
        return 1;
    }
    return localeCompare(violation1.name, violation2.name);
});

@joekaufmanexpensify joekaufmanexpensify added the External Added to denote the issue can be worked on by a contributor label Jun 27, 2024
@melvin-bot melvin-bot bot changed the title Putting an expense on hold causes the Duplicate message to show in the transaction preview [$250] Putting an expense on hold causes the Duplicate message to show in the transaction preview Jun 27, 2024
Copy link

melvin-bot bot commented Jun 27, 2024

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

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

melvin-bot bot commented Jun 27, 2024

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

@joekaufmanexpensify
Copy link
Contributor

cc @pecanoro as you mentioned in the slack thread you wanted to follow along

@pecanoro pecanoro self-assigned this Jun 27, 2024
@nkdengineer
Copy link
Contributor

Proposal

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

The dot separator pattern shows Duplicate

What is the root cause of that problem?

We always show the first violation in MoneyRequestPreviewContent meanwhile the newest violation is the last violation.

if (violations?.[0]) {
const violationMessage = ViolationsUtils.getViolationTranslation(violations[0], translate);

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

We should show the last violation here instead of the first violation

const violationsLength = (violations ?? []).length - 1;
if (violations?.[violationsLength]) {
    const violationMessage = ViolationsUtils.getViolationTranslation(violations[violationsLength], translate);

if (violations?.[0]) {
const violationMessage = ViolationsUtils.getViolationTranslation(violations[0], translate);

What alternative solutions did you explore? (Optional)

@joekaufmanexpensify
Copy link
Contributor

Proposals awaiting review

@joekaufmanexpensify
Copy link
Contributor

Same

@melvin-bot melvin-bot bot added the Overdue label Jul 1, 2024
@pecanoro
Copy link
Contributor

pecanoro commented Jul 1, 2024

@abdulrahuman5196 Friendly bump to review the proposal!

Copy link

melvin-bot bot commented Jul 1, 2024

@pecanoro, @abdulrahuman5196, @joekaufmanexpensify Whoops! This issue is 2 days overdue. Let's get this updated quick!

@abdulrahuman5196
Copy link
Contributor

Hi, Sorry for the delay. Will check on this today.

@melvin-bot melvin-bot bot removed the Overdue label Jul 2, 2024
@joekaufmanexpensify
Copy link
Contributor

TY!

Copy link

melvin-bot bot commented Jul 4, 2024

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

@melvin-bot melvin-bot bot added the Overdue label Jul 4, 2024
Copy link

melvin-bot bot commented Jul 5, 2024

@pecanoro, @abdulrahuman5196, @joekaufmanexpensify Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@joekaufmanexpensify
Copy link
Contributor

@abdulrahuman5196 is there an update here?

@melvin-bot melvin-bot bot removed the Overdue label Jul 8, 2024
@abdulrahuman5196
Copy link
Contributor

Hi, @joekaufmanexpensify Sorry for the delay. I am having lesser availability now. Kindly re-assign labels for another C+. I am unasigning myself.

@abdulrahuman5196 abdulrahuman5196 removed their assignment Jul 8, 2024
@pecanoro pecanoro removed the Bug Something is broken. Auto assigns a BugZero manager. label Jul 9, 2024
@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production labels Jul 19, 2024
@melvin-bot melvin-bot bot changed the title [$250] Putting an expense on hold causes the Duplicate message to show in the transaction preview [HOLD for payment 2024-07-26] [$250] Putting an expense on hold causes the Duplicate message to show in the transaction preview Jul 19, 2024
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Jul 19, 2024
Copy link

melvin-bot bot commented Jul 19, 2024

Reviewing label has been removed, please complete the "BugZero Checklist".

Copy link

melvin-bot bot commented Jul 19, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.9-5 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

If no regressions arise, payment will be issued on 2024-07-26. 🎊

For reference, here are some details about the assignees on this issue:

Copy link

melvin-bot bot commented Jul 19, 2024

BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

  • [@DylanDylann] The PR that introduced the bug has been identified. Link to the PR: N/A
  • [@DylanDylann] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment: N/A
  • [@DylanDylann] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion: N/A
  • [@DylanDylann] Determine if we should create a regression test for this bug.
  • [@DylanDylann] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
  • [@joekaufmanexpensify] Link the GH issue for creating/updating the regression test once above steps have been agreed upon: https://github.com/Expensify/Expensify/issues/415182

@joekaufmanexpensify
Copy link
Contributor

@DylanDylann Please handle the BZ checklist so we can prep to issue payment this week

@DylanDylann
Copy link
Contributor

BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

[@DylanDylann] The PR that introduced the bug has been identified. Link to the PR: NA
[@DylanDylann] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment: NA
[@DylanDylann] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion: NA
[@DylanDylann] Determine if we should create a regression test for this bug. Yes
[@DylanDylann] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.

Regression Test Proposal

  1. Have user A submit two same expenses to user B on a Collect workspace
  2. User B manually holds one of the expenses which is also a duplicate expense
  3. Verify that: the held expense's dot separator pattern shows 'Hold'

Do we agree 👍 or 👎

@joekaufmanexpensify
Copy link
Contributor

Looks solid! I will tackle this tomorrow.

@joekaufmanexpensify
Copy link
Contributor

@daledah is your Upwork account no longer active? I am no longer able to view it from when we paid you on a prior issue to send you an offer for this one.

@joekaufmanexpensify
Copy link
Contributor

BZ checklist is complete!

@joekaufmanexpensify
Copy link
Contributor

Payment owed here is:

@joekaufmanexpensify
Copy link
Contributor

All set to issue payment!

@joekaufmanexpensify
Copy link
Contributor

@DylanDylann $250 sent and contract ended!

@joekaufmanexpensify
Copy link
Contributor

@daledah please apply for the job in Upwork, or confirm the status of your upwork profile so we can pay you.

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Jul 26, 2024
@daledah

This comment was marked as outdated.

@melvin-bot melvin-bot bot added the Overdue label Jul 29, 2024
@daledah
Copy link
Contributor

daledah commented Jul 29, 2024

@daledah is your Upwork account no longer active?

@joekaufmanexpensify It's working well now, could you send an offer to my profile https://www.upwork.com/freelancers/~0138d999529f34d33f

Thanks

@joekaufmanexpensify
Copy link
Contributor

@daledah offer sent for $250!

@melvin-bot melvin-bot bot removed the Overdue label Jul 29, 2024
@daledah
Copy link
Contributor

daledah commented Jul 30, 2024

@joekaufmanexpensify I accepted it now

@joekaufmanexpensify
Copy link
Contributor

@daledah $250 sent and contract ended!

@joekaufmanexpensify
Copy link
Contributor

Upwork job closed.

@joekaufmanexpensify
Copy link
Contributor

All set, thanks everyone!

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
Status: Done
Development

No branches or pull requests

8 participants