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

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

Closed
1 of 6 tasks
lanitochka17 opened this issue Mar 20, 2024 · 9 comments
Closed
1 of 6 tasks
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Engineering Reviewing Has a PR in review

Comments

@lanitochka17
Copy link

lanitochka17 commented Mar 20, 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.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

@lanitochka17 lanitochka17 added the DeployBlockerCash This issue or pull request should block deployment label Mar 20, 2024
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 Mar 20, 2024

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

@lanitochka17
Copy link
Author

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

@lanitochka17
Copy link
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

@trjExpensify trjExpensify 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 Mar 20, 2024
@dragnoir
Copy link
Contributor

dragnoir commented Mar 20, 2024

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)

@MrMuzyk
Copy link
Contributor

MrMuzyk commented Mar 20, 2024

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

@trjExpensify trjExpensify added Daily KSv2 and removed DeployBlockerCash This issue or pull request should block deployment Hourly KSv2 labels Mar 20, 2024
@trjExpensify trjExpensify added the Bug Something is broken. Auto assigns a BugZero manager. label Mar 20, 2024
Copy link

melvin-bot bot commented Mar 20, 2024

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

@trjExpensify
Copy link
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.

@luacmartins luacmartins self-assigned this Mar 20, 2024
@luacmartins luacmartins added the Reviewing Has a PR in review label Mar 21, 2024
@mountiny
Copy link
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
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Engineering Reviewing Has a PR in review
Projects
No open projects
Archived in project
Development

No branches or pull requests

7 participants