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-03-25] [$500] Can't unselect category when editing a split bill #37146

Closed
6 tasks done
m-natarajan opened this issue Feb 23, 2024 · 40 comments
Closed
6 tasks done
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor Weekly KSv2

Comments

@m-natarajan
Copy link

m-natarajan commented Feb 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: 1.4.43-14
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: @DylanDylann
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1708412951140219

Action Performed:

  1. Go to workspace expense chat
  2. Click + button beside to composer
  3. Click Split Bill
  4. Click Scan tab
  5. Choose a receipt (any image)
  6. Go to confirmation page
  7. Enter a category
  8. Click Split
  9. Unselect category

Expected Result:

Category should be removed

Actual Result:

Category still remain

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

Add any screenshot/video evidence

Screen.Recording.2024-02-20.at.14.05.21.mov
Recording.2774.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~018323df92a9ee320a
  • Upwork Job ID: 1761062942437457920
  • Last Price Increase: 2024-03-08
@m-natarajan m-natarajan added External Added to denote the issue can be worked on by a contributor Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Feb 23, 2024
Copy link

melvin-bot bot commented Feb 23, 2024

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

@melvin-bot melvin-bot bot changed the title Can't unselect category when editing a split bill [$500] Can't unselect category when editing a split bill Feb 23, 2024
@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Feb 23, 2024
Copy link

melvin-bot bot commented Feb 23, 2024

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

Copy link

melvin-bot bot commented Feb 23, 2024

Triggered auto assignment to @puneetlath (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

@dukenv0307
Copy link
Contributor

dukenv0307 commented Feb 23, 2024

Proposal

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

What is the root cause of that problem?

We are using this logic to unselect a category

const isSelectedCategory = category.searchText === transactionCategory;
const updatedCategory = isSelectedCategory ? '' : category.searchText;

But in here

IOU.setDraftSplitTransaction(transaction.transactionID, {category: category.searchText});

We don't use updatedCategory

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

We should use updatedCategory like this

IOU.setDraftSplitTransaction(transaction.transactionID, {category: updatedCategory});

What alternative solutions did you explore? (Optional)

@brandonhenry
Copy link
Contributor

brandonhenry commented Feb 24, 2024

this one is a regression from 0d3a9f4 @dukenv0307 was the owner on that one

@dukenv0307
Copy link
Contributor

@brandonhenry It is not a regression as mentioned here

cc @DylanDylann

@DylanDylann
Copy link
Contributor

DylanDylann commented Feb 24, 2024

Hi everyone, I saw this bug while reviewing this PR. I agree that this bug happened before and It isn't caused by this PR. But I am not sure whether it's an intentional or a bug. It is reason why I reported new bug for it

@DylanDylann
Copy link
Contributor

I have more context here, If we need to speed up this issue, I could take over this one

@wildan-m
Copy link
Contributor

@DylanDylann how can we make the category mandatory? I've asked it here, but haven't received an answer yet.

What I've tried: Created a control workspace in oldot and enabled the must-use category, but with no success.

@wildan-m
Copy link
Contributor

wildan-m commented Feb 25, 2024

Proposal

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

Unable to deselect options while editing a split bill. The options may include category or tag.

What is the root cause of that problem?

For the category issue, we are currently utilizing category.searchText instead of updatedCategory for updating the category.

if (isEditingSplitBill) {
IOU.setDraftSplitTransaction(transaction.transactionID, {category: category.searchText});
navigateBack();
return;
}

For the tag, the problem lies in our use of transaction instead of splitDraftTransaction.

const transactionTag = TransactionUtils.getTag(transaction);
const tag = TransactionUtils.getTag(transaction, tagIndex);

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

We can revise this line:

IOU.setDraftSplitTransaction(transaction.transactionID, {category: category.searchText});

to

            IOU.setDraftSplitTransaction(transaction.transactionID, {category: updatedCategory});

And modify the transaction here:

const transactionTag = TransactionUtils.getTag(transaction);
const tag = TransactionUtils.getTag(transaction, tagIndex);

to

    const transactionToUse = isEditing && isSplitBill ? splitDraftTransaction : transaction;
    const transactionTag = TransactionUtils.getTag(transactionToUse);
    const tag = TransactionUtils.getTag(transactionToUse, tagIndex);    

Where splitDraftTransaction is

        splitDraftTransaction: {
            key: ({route}) => {
                const transactionID = lodashGet(route, 'params.transactionID', 0);
                return `${ONYXKEYS.COLLECTION.SPLIT_TRANSACTION_DRAFT}${transactionID}`;
            },
        },

This might also need to be implemented for taxes, but I have noticed that the tax functionality is not working correctly yet. I frequently encountered a "hmm not found" error when selecting the tax.

Branch to test.

What alternative solutions did you explore? (Optional)

@melvin-bot melvin-bot bot added the Overdue label Feb 25, 2024
Copy link

melvin-bot bot commented Feb 27, 2024

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

@puneetlath
Copy link
Contributor

@eVoloshchak thoughts on the proposals?

@melvin-bot melvin-bot bot removed the Overdue label Feb 28, 2024
@dukenv0307
Copy link
Contributor

@eVoloshchak My proposal is enough to fix the original bug. But in @wildan-m's proposal, he mentioned a completely new bug. The bug in the tag page is that we can't update the new tag in the split bill page. The solution for this new bug in @wildan-m's proposal will cause the regression like this one

If we also decide to fix new bug in here. This is my suggestion

   // const transactionTag = TransactionUtils.getTag(transaction);  // REMOVE
    // const tag = TransactionUtils.getTag(transaction, tagIndex); // REMOVE
    // const isSplitBill = iouType === CONST.IOU.TYPE.SPLIT;   // REMOVE
    const isEditing = action === CONST.IOU.ACTION.EDIT;
    const isEditingSplitBill = isEditing && iouType === CONST.IOU.TYPE.SPLIT;
    const {tag: transactionTag} = ReportUtils.getTransactionDetails(isEditingSplitBill && !lodashIsEmpty(splitDraftTransaction) ? splitDraftTransaction : transaction);     
// splitDraftTransaction is import from ONYX

And using transactionTag instead of tag in all places

@wildan-m
Copy link
Contributor

wildan-m commented Mar 1, 2024

@dukenv0307 Thanks for your concern. I can't reproduce this category regression with tag, so provide empty check for tag might be optional.

If the OP knows that this similar unselect issue occured for tag as well, I believe He/She will include it in the bug description. For me it does make sense to solve similar issue in one PR, similar to what we have done here.

@eVoloshchak
Copy link
Contributor

Unable to test this properly due to a bug on split page, the whole page is flickering and category isn't possible to select
Will circle back to this tomorrow to see if the bug is resolved so I can properly review this

Screen.Recording.2024-03-01.at.16.45.13.mov

Copy link

melvin-bot bot commented Mar 1, 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 Mar 4, 2024
@eVoloshchak
Copy link
Contributor

For the tag, the problem lies in our use of transaction instead of splitDraftTransaction.

@wildan-m, the behavior is different than for category, this does look like a separate bug, I think we should handle it in a separate issue

I think we should proceed with @dukenv0307's proposal

🎀👀🎀 C+ reviewed!

@melvin-bot melvin-bot bot removed the Overdue label Mar 4, 2024
Copy link

melvin-bot bot commented Mar 4, 2024

Current assignee @puneetlath is eligible for the choreEngineerContributorManagement assigner, not assigning anyone new.

@dukenv0307
Copy link
Contributor

@puneetlath Please help to take a look at this one when you have a chance

@melvin-bot melvin-bot bot removed the Overdue label Mar 12, 2024
@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Mar 12, 2024
Copy link

melvin-bot bot commented Mar 12, 2024

❌ There was an error making the offer to @dukenv0307 for the Contributor role. The BZ member will need to manually hire the contributor.

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Daily KSv2 Weekly KSv2 labels Mar 13, 2024
@melvin-bot melvin-bot bot changed the title [$500] Can't unselect category when editing a split bill [HOLD for payment 2024-03-25] [$500] Can't unselect category when editing a split bill Mar 18, 2024
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Mar 18, 2024
Copy link

melvin-bot bot commented Mar 18, 2024

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

Copy link

melvin-bot bot commented Mar 18, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.53-2 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-03-25. 🎊

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

  • @eVoloshchak requires payment through NewDot Manual Requests
  • @dukenv0307 requires payment (Needs manual offer from BZ)
  • @DylanDylann requires payment (Needs manual offer from BZ)

Copy link

melvin-bot bot commented Mar 18, 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:

  • [@eVoloshchak / @dukenv0307] The PR that introduced the bug has been identified. Link to the PR:
  • [@eVoloshchak / @dukenv0307] 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:
  • [@eVoloshchak / @dukenv0307] 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:
  • [@eVoloshchak / @dukenv0307] Determine if we should create a regression test for this bug.
  • [@eVoloshchak / @dukenv0307] 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.
  • [@puneetlath] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@puneetlath
Copy link
Contributor

@eVoloshchak friendly reminder about the checklist so that we can pay on Monday.

@puneetlath
Copy link
Contributor

@dukenv0307 offer is here: https://www.upwork.com/nx/wm/offer/101566868

@eVoloshchak still waiting on the checklist.

@eVoloshchak
Copy link
Contributor

eVoloshchak commented Mar 25, 2024

@eVoloshchak
Copy link
Contributor

Regression Test Proposal

  1. Go to workspace expense chat
  2. Click + button beside the composer
  3. Click Split Bill
  4. Click Scan tab
  5. Choose a receipt (any image)
  6. Go to confirmation page
  7. Enter a category
  8. Click Split
  9. Click on the created IOU request -> Category
  10. Unselect the category
  11. Verify that category is removed

Do we agree 👍 or 👎

@puneetlath
Copy link
Contributor

(resetMoneyRequestCategory_temporaryForRefactor) it was planned to fix this in the subsequent PR(s), but that wasn't the case

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

Can we comment on the PR in that case? It's not ideal to create a temporary method and then never finish it. Especially since it led to a bug.

@puneetlath
Copy link
Contributor

@eVoloshchak bump!

@eVoloshchak
Copy link
Contributor

Apologies, I was wrong about the PR that has caused this.
As discussed in https://github.com/Expensify/App/pull/35458/files#r1494844943, this is the old logic carried over from EditSplitBillPage. Updated the checklist

@puneetlath
Copy link
Contributor

Payment summary:

@eVoloshchak please request on NewDot. Thanks everyone!

@JmillsExpensify
Copy link

$500 approved for @eVoloshchak

@dukenv0307
Copy link
Contributor

C - $500 - @dukenv0307 - paid on Upwork

@puneetlath Looks like the contract for me is still not paid out, can you kindly double check?

@puneetlath
Copy link
Contributor

Weird, you're right. I went ahead and paid it.

@dukenv0307
Copy link
Contributor

@puneetlath Thank you 🙏

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. External Added to denote the issue can be worked on by a contributor Weekly KSv2
Projects
None yet
Development

No branches or pull requests

8 participants