Skip to content

[Distance rates] Category - Cannot cancel the category selection in distance rates settings #38673

Closed

Description

@lanitochka17

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: 1.4.55-0
Reproducible in staging?: Y
Reproducible in production?: N
If this was caught during regression testing, add the test name, ID and link from TestRail: N/A
Issue reported by: Applause - Internal Team

Issue found when executing PR #38060

Action Performed:

Precondition:

  • User is an admin of Collect workspace.
  • User has paid policy with distance rates available
  1. Go to URL staging.new.expensify.com.
  2. Go to Profile > Workspaces -> choose Collect workspace
  3. Go to the distance rates screen -> Press on settings -> Default category
  4. Choose any category
  5. Open the default category again and click on the same category to unselect it

Expected Result:

User can unselect the category in distance rates settings

Actual Result:

Cannot cancel the category selection in distance rates settings

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

Bug6420487_1710941440438.bandicam_2024-03-20_15-13-08-247.mp4

View all open jobs on GitHub

Activity

  1. github-actions commented on Mar 20, 2024

    @github-actions
    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.
  2. melvin-bot commented on Mar 20, 2024

    @melvin-bot

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

  3. lanitochka17 commented on Mar 20, 2024

    @lanitochka17
    Author

    We think that this bug might be related to #wave-collect - Release 1

  4. lanitochka17 commented on Mar 20, 2024

    @lanitochka17
    Author

    @Beamanator 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

  5. changed the title [-]Category - Cannot cancel the category selection in distance rates settings[/-] [+][Distance rates] Category - Cannot cancel the category selection in distance rates settings[/+] on Mar 20, 2024
  6. dragnoir commented on Mar 20, 2024

    @dragnoir
    Contributor

    Proposal

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

    Cannot cancel the category selection in distance rates settings

    What is the root cause of that problem?

    We are not checking if if the selected category is the same as the already existing one

    const setNewCategory = (category: ListItem) => {
    Policy.setPolicyDistanceRatesDefaultCategory(policyID, customUnit, {...customUnit, defaultCategory: category.text});
    };

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

    inside setNewCategory we need to check if the selected category is the same as the already existing one

    const  isSelectedCategory  =  category.text  ===  defaultCategory;
    const  updatedCategory  =  isSelectedCategory  ?  ''  :  category.text;

    as we do here

    const updateCategory = (category) => {
    const isSelectedCategory = category.searchText === transactionCategory;
    const updatedCategory = isSelectedCategory ? '' : category.searchText;

    const setNewCategory = (category: ListItem) => {
    
            const isSelectedCategory = category.text === defaultCategory;
            const updatedCategory = isSelectedCategory ? '' : category.text;
    
            Policy.setPolicyDistanceRatesDefaultCategory(policyID, customUnit, {...customUnit, defaultCategory: updatedCategory});
        };

    POC video:

    20240320_152506.mp4

    What alternative solutions did you explore? (Optional)

  7. MrMuzyk commented on Mar 20, 2024

    @MrMuzyk
    Contributor

    I will fix this in the next PR that adds another screen to distance rates feature. Currently its in draft state #38237

  8. added and removed
    DeployBlockerCashThis issue or pull request should block deployment
    on Mar 20, 2024
  9. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Mar 20, 2024
  10. melvin-bot commented on Mar 20, 2024

    @melvin-bot

    Current assignee @trjExpensify is eligible for the Bug assigner, not assigning anyone new.

  11. trjExpensify commented on Mar 20, 2024

    @trjExpensify
    Contributor

    Related discussion here: https://expensify.slack.com/archives/C036QM0SLJK/p1710945911418889?thread_ts=1710800247.591739&cid=C036QM0SLJK

    This isn't a blocker, demoting it. @MrMuzyk is going to fix it in the follow-up PR.

  12. self-assigned this
    on Mar 20, 2024
  13. mountiny commented on Mar 27, 2024

    @mountiny
    Contributor

    The PR has been merged and C+ payment is handled elsewhere, I believe we can close this issue now as no further steps are required, thanks @MrMuzyk !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugSomething is broken. Auto assigns a BugZero manager.DailyKSv2EngineeringReviewingHas a PR in review

Type

No type

Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions