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-04-15] [$500] [Simplified Collect][Categories] - "Categorize all expense" switch is not disabled when all categories are disabled #37508

Closed
6 tasks done
m-natarajan opened this issue Feb 29, 2024 · 66 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 Engineering External Added to denote the issue can be worked on by a contributor

Comments

@m-natarajan
Copy link

m-natarajan commented Feb 29, 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: v1.4.45-1

Reproducible in staging?: Yes
Reproducible in production?: No
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: Applause internal team
Slack conversation:

Action Performed:

Precondition:

  • User is admin of Collect workspace that has categories.
  • All categories are disabled in the Collect workspace.
  1. Go to staging.new.expensify.com
  2. Go to workspace settings.
  3. Select the Collect workspace.
  4. Click Categories.
  5. Click Settings.
  6. Click on the toggle.

Expected Result:

"Categorize all expense" switch should be disabled.

Actual Result:

"Categorize all expense" switch can be toggled on and off. On Old Dot, the switch is disabled when all categories are disabled.

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

Bug6397092_1709215690576.20240229_113907.mp4

Add any screenshot/video evidence

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~014c2567013c13680f
  • Upwork Job ID: 1771256687469146112
  • Last Price Increase: 2024-03-22
  • Automatic offers:
    • getusha | Reviewer | 0
    • tienifr | Contributor | 0
@m-natarajan m-natarajan added DeployBlockerCash This issue or pull request should block deployment Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Feb 29, 2024
Copy link

melvin-bot bot commented Feb 29, 2024

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

Copy link
Contributor

👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

  1. Identify the pull request that introduced this issue and revert it.
  2. Find someone who can quickly fix the issue.
  3. Fix the issue yourself.

Copy link

melvin-bot bot commented Feb 29, 2024

Triggered auto assignment to @luacmartins (Engineering), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.

@m-natarajan
Copy link
Author

We think that this bug might be related to #wave8-collect-admins
cc @zanyrenney

@m-natarajan
Copy link
Author

@luacmartins FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors.

@eucool
Copy link
Contributor

eucool commented Feb 29, 2024

Proposal

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

"Categorize all expense" switch is not disabled when all categories are disabled

What is the root cause of that problem?

We don't have a conditional rendering check to see if it is disabled:

<View style={[styles.flexRow, styles.mb5, styles.mr2, styles.alignItemsCenter, styles.justifyContentBetween]}>
<Text style={[styles.textNormal, styles.colorMuted]}>{translate('workspace.categories.requiresCategory')}</Text>
<Switch
isOn={policy?.requiresCategory ?? false}
accessibilityLabel={translate('workspace.categories.requiresCategory')}
onToggle={updateWorkspaceRequiresCategory}
/>

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

We need to check the boolean areCategoriesEnabled which would be implemented as per comments, and allow the toggle if the value is true or else simply disable the toggle , Also we need to check the length of the enabled categories, if it is 0 then simply disable the button:

<Switch
      isOn={!policy?.areCategoriesEnabled}
      disabled={OptionsListUtils.getEnabledCategoriesCount( ) === 0}
      accessibilityLabel={translate('workspace.categories.requiresCategory')}
      onToggle={updateWorkspaceRequiresCategory}
                                    />

What alternative solutions did you explore? (Optional)

N/A

@luacmartins
Copy link
Contributor

I don't think this is a blocker. We're still developing this feature. I'll tag @ArekChr so we can fix this as part of a follow up issue.

@luacmartins luacmartins added Daily KSv2 and removed DeployBlockerCash This issue or pull request should block deployment Hourly KSv2 labels Feb 29, 2024
@Krishna2323
Copy link
Contributor

@luacmartins, is this open for proposals?

@Krishna2323
Copy link
Contributor

Krishna2323 commented Feb 29, 2024

Proposal

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

Category - "Categorize all expense" switch is not disabled when all categories are disabled

What is the root cause of that problem?

We don't check if the policyCategories contains any enabled option or not before updating requiresCategory.
Here isOn is true when policy?.requiresCategory but it should also check for any enabled option.

isOn={policy?.requiresCategory ?? false}

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

To solve this issue for we need to get policyCategories from onyx & then create a variable like hasEnabledOptions and use OptionsListUtils.hasEnabledOptions(policyCategories ?? {}); as value.

We also need to disable Switch when hasEnabledOptions is false, for that we can accept a disabled prop in Switch and pass it to PressableWithFeedback. The value passed to disabled prop in Switch will be !hasEnabledOptions.

Also, update isOn={policy?.requiresCategory ?? false} to isOn={(policy?.requiresCategory ?? false) && hasEnabledOptions}

For turning the switch off we can use hasEnabledOptions.

isOn={(policy?.requiresCategory ?? false) && hasEnabledOptions}

Result

switch_not_disabled_policy_categories.mp4

Alternative

Check for areCategoriesEnabled key instead of hasEnabledOptions.

@luacmartins
Copy link
Contributor

I'm gonna put this on hold for now, since we're introducing a new areCategoriesEnabled key and we should be checking that key

@luacmartins luacmartins changed the title Category - "Categorize all expense" switch is not disabled when all categories are disabled [HOLD More Features] Category - "Categorize all expense" switch is not disabled when all categories are disabled Feb 29, 2024
@melvin-bot melvin-bot bot added the Overdue label Mar 4, 2024
Copy link

melvin-bot bot commented Mar 4, 2024

@abekkala, @luacmartins Whoops! This issue is 2 days overdue. Let's get this updated quick!

@luacmartins
Copy link
Contributor

this is on hold

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

abekkala commented Mar 4, 2024

Not overdue, on Hold

@eucool
Copy link
Contributor

eucool commented Mar 5, 2024

Updated proposal based on comments

@melvin-bot melvin-bot bot added the Overdue label Mar 7, 2024
@tienifr
Copy link
Contributor

tienifr commented Mar 26, 2024

Will be ready in 1 hour.

@luacmartins
Copy link
Contributor

Nice! Please ping me once it's ready!

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Mar 27, 2024
@stephanieelliott
Copy link
Contributor

PR is under active review!

@stephanieelliott
Copy link
Contributor

PR is undergoing QA

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Apr 8, 2024
@melvin-bot melvin-bot bot changed the title [$500] [Simplified Collect][Categories] - "Categorize all expense" switch is not disabled when all categories are disabled [HOLD for payment 2024-04-15] [$500] [Simplified Collect][Categories] - "Categorize all expense" switch is not disabled when all categories are disabled Apr 8, 2024
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Apr 8, 2024
Copy link

melvin-bot bot commented Apr 8, 2024

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

Copy link

melvin-bot bot commented Apr 8, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.60-13 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-04-15. 🎊

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

Copy link

melvin-bot bot commented Apr 8, 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:

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

@abekkala
Copy link
Contributor

abekkala commented Apr 8, 2024

PAYMENT SUMMARY FOR APRIL 15

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Apr 14, 2024
@abekkala
Copy link
Contributor

@getusha can you complete the checklist above, please?

@abekkala
Copy link
Contributor

@tienifr payment sent and contract ended - thank you! 🎉

@getusha
Copy link
Contributor

getusha commented Apr 16, 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:

[@getusha] The PR that introduced the bug has been identified. Link to the PR: I don't think this was a regression, it's something that was not considered when implementing the page.
[@getusha] 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
[@getusha] 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
[@getusha] Determine if we should create a regression test for this bug. Yes
[@getusha] 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. Go to a collect workspace settings.
  2. Select the Collect workspace.
  3. Click on Categories.
  4. Disable every categories
  5. Click on Settings.
  6. Verify that "Members must categorize all spend" should be turned off and disabled
  7. Enable at least one category > Settings
  8. Verify that "Members must categorize all spend" can be toggled.
  9. Delete the enabled category
  10. Click on Settings
  11. Verify that "Members must categorize all spend" should be turned off and disabled

Do we agree 👍 or 👎

@luacmartins
Copy link
Contributor

No need to add tests. We already did so as part of the project.

@abekkala
Copy link
Contributor

@getusha once you accept the offer I can send payment
Upwork Offer

@getusha
Copy link
Contributor

getusha commented Apr 16, 2024

@abekkala accepted, thanks.

@abekkala
Copy link
Contributor

@getusha payment sent and contract ended - 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. Daily KSv2 Engineering External Added to denote the issue can be worked on by a contributor
Projects
No open projects
Archived in project
Development

No branches or pull requests

8 participants