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-01-24] [$500] Category - Selected category is not in the list when it is disabled and there is <8 categories #29901

Closed
6 tasks done
lanitochka17 opened this issue Oct 18, 2023 · 64 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

@lanitochka17
Copy link

lanitochka17 commented Oct 18, 2023

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.3.86-1
Reproducible in staging?: Yes
Reproducible in production?: Yes
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: There must be less than 8 categories in the workspace.

  1. [Employee] Create a manual receipt with a category
  2. [Admin] Go to OldDot and disable the category that is used in Step 1
  3. [Employee] Go to the expense details page and click Category

Expected Result:

The selected category will appear in the list with a green tick mark

Actual Result:

The selected category is not present in the category list

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

Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
Bug6242102_1697653864127.20231018_201159.mp4
MacOS: Desktop

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~0118e9d838643f7221
  • Upwork Job ID: 1714715542878093312
  • Last Price Increase: 2023-12-06
  • Automatic offers:
    • aimane-chnaif | Reviewer | 28037671
    • DylanDylann | Contributor | 28037673
@lanitochka17 lanitochka17 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 Oct 18, 2023
@melvin-bot melvin-bot bot changed the title Category - Selected category is not in the list when it is disabled and there is <8 categories [$500] Category - Selected category is not in the list when it is disabled and there is <8 categories Oct 18, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 18, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Oct 18, 2023

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

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

melvin-bot bot commented Oct 18, 2023

Bug0 Triage Checklist (Main S/O)

  • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
  • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
    • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
  • This bug is reproducible using the reproduction steps in the OP. S/O
    • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
    • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
  • This issue is filled out as thoroughly and clearly as possible
    • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
  • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync

@melvin-bot
Copy link

melvin-bot bot commented Oct 18, 2023

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

@cooldev900
Copy link
Contributor

@lanitochka17
could you please upload videos for this issue?

@abdel-h66
Copy link
Contributor

abdel-h66 commented Oct 18, 2023

Proposal

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

A disable category will never show up in the categories when it's selected and the category count is less than 8.

What is the root cause of that problem?

  • The user expects to see the selected category within the categories list even if it's disabled, because hiding while it's actually selected is misleading.
  • The first, that getCategoryListSections does, is to filter out any disabled options via. →
    const categoriesValues = _.chain(categories)
        .values()
        .filter((category) => category.enabled)
        .value();

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

→ We should find the selected, but disabled categories using the following =>

    const selectedDisabledOptions = _.filter(categories, (category) => !category.enabled && selectedOptions.find((option) => option.name === category.name));

→ In the case of numberOfCategories < CATEGORY_LIST_THRESHOLD
We add the follwing

        if(selectedDisabledOptions.length > 0) { 
            categorySections.push({
                // "Selected" section
                title: '',
                shouldShow: false,
                indexOffset: 0,
                data: getCategoryOptionTree(selectedOptions, true),
            });
        } 

And keep the rest the same.
less-8
categorries above threshold

What alternative solutions did you explore? (Optional)

N/A

@DylanDylann
Copy link
Contributor

DylanDylann commented Oct 20, 2023

Proposal

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

Selected category is not in the list when it is disabled and there is <8 categories

What is the root cause of that problem?

Let's see the logic to get categories

if (numberOfCategories < CONST.CATEGORY_LIST_THRESHOLD) {

If numberOfCategories < 8, we return all enable categories

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

we should move this code

if (!_.isEmpty(selectedOptions)) {
categorySections.push({
// "Selected" section
title: '',
shouldShow: false,
indexOffset,
data: getCategoryOptionTree(selectedOptions, true),
});
indexOffset += selectedOptions.length;
}

to before

if (numberOfCategories < CONST.CATEGORY_LIST_THRESHOLD) {

and in here

data: getCategoryOptionTree(categoriesValues),

update to

data: getCategoryOptionTree(lodashDifferenceBy(categoriesValues, selectedOptions, 'name')),

One more thing, when there is a selected category we also need to decrease the threshold to ensure we only display 7 categories
in here

if (numberOfCategories < CONST.CATEGORY_LIST_THRESHOLD) {

update like that

const categoryListThreshold = !_.isEmpty(selectedOptions) ? CONST.CATEGORY_LIST_THRESHOLD - 1 : CONST.CATEGORY_LIST_THRESHOLD;

    if (numberOfCategories < categoryListThreshold) {

What alternative solutions did you explore? (Optional)

@lanitochka17
Copy link
Author

@cooldev900 Hello
The video has been added to the Screenshot tab.

image

@melvin-bot melvin-bot bot added the Overdue label Oct 21, 2023
@cooldev900
Copy link
Contributor

Thank you

@melvin-bot
Copy link

melvin-bot bot commented Oct 24, 2023

@bfitzexpensify, @aimane-chnaif Eep! 4 days overdue now. Issues have feelings too...

@bfitzexpensify
Copy link
Contributor

Couple of proposals ready for review @aimane-chnaif

@melvin-bot melvin-bot bot removed the Overdue label Oct 24, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 25, 2023

📣 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 Oct 27, 2023
@bfitzexpensify
Copy link
Contributor

Bump on proposal review @aimane-chnaif - thank you!

@melvin-bot melvin-bot bot removed the Overdue label Oct 27, 2023
@aimane-chnaif
Copy link
Contributor

reviewing

@melvin-bot melvin-bot bot added the Overdue label Oct 30, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 31, 2023

@bfitzexpensify, @aimane-chnaif Whoops! This issue is 2 days overdue. Let's get this updated quick!

@aimane-chnaif
Copy link
Contributor

@abdel-h66 @DylanDylann how were you able to remove category in oldDot?

@melvin-bot melvin-bot bot removed the Overdue label Oct 31, 2023
@DylanDylann
Copy link
Contributor

DylanDylann commented Oct 31, 2023

  1. Create control or collect workspace on old dot
Screenshot 2023-10-31 at 20 51 03

After creating It looks like

Screenshot 2023-11-30 at 00 18 26
  1. CLick on created workspace in step 1. Copy the workspace ID of above workspace
Screenshot 2023-10-31 at 20 51 43
  1. Hard-code this ID in the codebase of new dot
    Ex:
    key: ({policyID}) => `${ONYXKEYS.COLLECTION.POLICY_CATEGORIES}${policyID}`,

    Update this line to
key: ({policyID}) => `${ONYXKEYS.COLLECTION.POLICY_CATEGORIES}${'27F77FC4AB5B21A4'}`, // hard code policyID in step 2
  1. Update the category of that ws in old dot

Copy link

melvin-bot bot commented Dec 11, 2023

Triggered auto assignment to @yuwenmemon, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Dec 11, 2023
Copy link

melvin-bot bot commented Dec 11, 2023

📣 @aimane-chnaif 🎉 An offer has been automatically sent to your Upwork account for the Reviewer role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job

Copy link

melvin-bot bot commented Dec 11, 2023

📣 @DylanDylann 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job
Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
Keep in mind: Code of Conduct | Contributing 📖

@DylanDylann
Copy link
Contributor

@aimane-chnaif The PR is ready for review

Copy link

melvin-bot bot commented Jan 8, 2024

This issue has not been updated in over 15 days. @yuwenmemon, @bfitzexpensify, @aimane-chnaif, @DylanDylann eroding to Monthly issue.

P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do!

@aimane-chnaif
Copy link
Contributor

Seems like automation was broken here

@mountiny mountiny changed the title [$500] Category - Selected category is not in the list when it is disabled and there is <8 categories [HOLD for payment 2024-01-24] [$500] Category - Selected category is not in the list when it is disabled and there is <8 categories Jan 24, 2024
@mountiny mountiny added Daily KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Reviewing Has a PR in review Monthly KSv2 labels Jan 24, 2024
@DylanDylann
Copy link
Contributor

@bfitzexpensify Could you help to move forward this issue?

@melvin-bot melvin-bot bot removed the Overdue label Jan 25, 2024
@bfitzexpensify
Copy link
Contributor

Payments complete.

Adding a manual BZ checklist here - please complete when you get a moment @aimane-chnaif

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:

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

@aimane-chnaif
Copy link
Contributor

The bug always existed always after implementing category.
This is unusual case and caught by QA team so no need regression test.

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
None yet
Development

No branches or pull requests

9 participants