Skip to content

[HOLD for payment 2024-06-13] [$250] Distance rate can be deleted from 3-dot menu when there is only one rate #41594

Closed

Description

@m-natarajan

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.70-0
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:

  • There is only one default distance rate in the workspace.
  1. Go to staging.new.expensify.com
  2. Go to Account settings > Workspaces > any workspace.
  3. Go to Distance rates.
  4. Go offline.
  5. Add a distance rate,
  6. Delete the default workspace rate (not the newly-added rate).
  7. Click on the checkbox of the newly added distance rate.
  8. Select Delete option from the dropdown.
  9. Note that the distance rate cannot be deleted because there must be at least one distance rate.
  10. Click on the distance rate row.
  11. Delete it from the three-dot menu.

Expected Result:

App will show the same pop-up in Step 9 that the distance rate cannot be deleted as there is only one distance rate.

Actual Result:

Distance rate can be deleted from 3-dot menu when there is only one distance rate.

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

Bug6470164_1714748306876.bandicam_2024-05-03_22-51-33-950.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/~0144c3fd2f5960b3c2
  • Upwork Job ID: 1786441064248098816
  • Last Price Increase: 2024-05-03
  • Automatic offers:
    • cretadn22 | Contributor | 0
Issue OwnerCurrent Issue Owner: @sobitneupane / @kevinksullivan

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on May 3, 2024
  2. melvin-bot commented on May 3, 2024

    @melvin-bot

    Triggered auto assignment to @slafortune (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

  3. m-natarajan commented on May 3, 2024

    @m-natarajan
    Author

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

  4. m-natarajan commented on May 3, 2024

    @m-natarajan
    Author

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

  5. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on May 3, 2024
  6. melvin-bot commented on May 3, 2024

    @melvin-bot
  7. changed the title [-]Distance rate can be deleted from 3-dot menu when there is only one rate[/-] [+][$250] Distance rate can be deleted from 3-dot menu when there is only one rate[/+] on May 3, 2024
  8. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on May 3, 2024
  9. melvin-bot commented on May 3, 2024

    @melvin-bot

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

  10. moved this to Release 1: Spring 2024 (May) in [#whatsnext] #wave-collecton May 3, 2024
  11. Krishna2323 commented on May 3, 2024

    @Krishna2323
    Contributor

    Proposal

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

    Distance rate can be deleted from 3-dot menu when there is only one rate

    What is the root cause of that problem?

    The condition canDeleteRate isn't correct.

    const canDeleteRate = Object.values(customUnit.rates).filter((distanceRate) => distanceRate.enabled).length > 1 || !rate.enabled;
    const canDisableRate = Object.values(customUnit.rates).filter((distanceRate) => distanceRate.enabled).length > 1;

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

    Remove || !rate.enabled check because user should not be able to delete the receipt until there is one more rate with enabled state. Also, I think we should canDeleteRate and canDisableRate filter out the rates that has pending action value delete. We might also want to filter out the rates with pending action value add. If we are going to filter out rates with pending action value add then we would also need to update that in PolicyDistanceRatesPage.

    Optionally, we can filter out as stated above without removing || !rate.enabled check

    Also check for other policy pages that has similar functionality

    What alternative solutions did you explore? (Optional)

    Only change the canDisableRate condition to exclude the rates with pending action delete and also add if needed.

  12. 47 remaining items

  13. melvin-bot commented on Jun 6, 2024

    @melvin-bot

    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:

    • [@sobitneupane] The PR that introduced the bug has been identified. Link to the PR:
    • [@sobitneupane] 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:
    • [@sobitneupane] 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:
    • [@sobitneupane] Determine if we should create a regression test for this bug.
    • [@sobitneupane] 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.
    • [@slafortune / @kevinksullivan] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:
  14. slafortune commented on Jun 13, 2024

    @slafortune
    Contributor

    @cretadn22 Paid ✔️
    @sobitneupane can you please complete the checklist?

  15. melvin-bot commented on Jun 17, 2024

    @melvin-bot

    @tgolen, @slafortune, @sobitneupane, @cretadn22 Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

  16. tgolen commented on Jun 19, 2024

    @tgolen
    Contributor

    bump @sobitneupane to complete the checklist, please.

  17. sobitneupane commented on Jun 20, 2024

    @sobitneupane
    Contributor

    Regression Test Proposal

    • Precondition: There is only one default distance rate in the workspace.
    1. Go to Settings > Workspaces > any workspace.
    2. Go to Distance rates.
    3. Go offline.
    4. Add a distance rate,
    5. Delete the default workspace rate (not the newly-added rate).
    6. Click on the checkbox of the newly added distance rate.
    7. Select Delete option from the dropdown.
    8. Verify that the distance rate cannot be deleted because there must be at least one distance rate.
    9. Click on the distance rate row.
    10. Delete it from the three-dot menu.
    11. Verify that the distance rate cannot be deleted because there must be at least one distance rate.

    Do we agree 👍 or 👎

  18. sobitneupane commented on Jun 20, 2024

    @sobitneupane
    Contributor

    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:

    • [@sobitneupane] The PR that introduced the bug has been identified. Link to the PR:

    #38237

    • [@sobitneupane] 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:

    #38237 (comment)

    • [@sobitneupane] Determine if we should create a regression test for this bug.

    yes

    • [@sobitneupane] 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.

    #41594 (comment)

  19. slafortune commented on Jun 20, 2024

    @slafortune
    Contributor

    @sobitneupane C+ is due $250 via NewDot

  20. moved this from Release 1: Spring 2024 (May) to Done in [#whatsnext] #wave-collecton Jun 20, 2024
  21. JmillsExpensify commented on Jun 22, 2024

    @JmillsExpensify
    Contributor

    $250 approved for @sobitneupane

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

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions