Skip to content

[$250][P2P Distance] - Disabled rate is not listed in the Rate list when it is still selected #46884

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: v9.0.17-0
Reproducible in staging?: y
Reproducible in production?: no, new feature
If this was caught during regression testing, add the test name, ID and link from TestRail: n/a
Email or phone of affected tester (no customers): applausetester+kh050801@applause.expensifail.com
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by: Applause internal team
Slack conversation:

Action Performed:

Precondition:

  • Workspace has some distance rates.
  1. Go to staging.new.expensify.com
  2. Go to workspace chat.
  3. Submit a distance expense with Distance rate A.
  4. Go to workspace settings > Distance rates.
  5. Disable Distance rate A used in Step 3.
  6. Go back to transaction thread of the distance expense.
  7. Click Rate.

Expected Result:

The disabled rate will appear selected in the Rate list but grayed out (like Category and Tag when selected and disabled afterward).

Actual Result:

The disabled rate is not listed in the Rate list when it is still selected.

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

Bug6563344_1722947953071.20240806_203405.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01113b3b52e50f7f4e
  • Upwork Job ID: 1821117740687763365
  • Last Price Increase: 2024-08-14
  • Automatic offers:
    • dominictb | Contributor | 103608790
Issue OwnerCurrent Issue Owner: @mananjadhav

Activity

  1. added
    DeployBlockerCash
    Daily
    Bug
    DeployBlocker
    on Aug 6, 2024
  2. melvin-bot commented on Aug 6, 2024

    @melvin-bot

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

  3. melvin-bot commented on Aug 6, 2024

    @melvin-bot

    Triggered auto assignment to @dylanexpensify (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.

  4. github-actions commented on Aug 6, 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.
  5. BhuvaneshPatil commented on Aug 6, 2024

    @BhuvaneshPatil
    Contributor

    Edited by proposal-police: This proposal was edited at 2024-08-06 14:00:06 UTC.

    PR - #40021

    I can raise PR if needed

    Proposal

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

    Distance rate which is selected but after disabling, not shown.

    What is the root cause of that problem?

    We are filtering the disabled rates when showing the rates list in selector.

    Object.entries(distanceUnit.rates).forEach(([rateID, rate]) => {
    if (!includeDisabledRates && rate.enabled === false) {
    return;
    }

    rates: {
    key: ({report}) => `${ONYXKEYS.COLLECTION.POLICY}${report?.policyID ?? '-1'}`,
    selector: (policy: OnyxEntry<OnyxTypes.Policy>) => DistanceRequestUtils.getMileageRates(policy),
    },

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

    We shall pass true as second argument that will give us disabled rates as well and we will also pass enabled value.

    rates: {
    key: ({report}) => `${ONYXKEYS.COLLECTION.POLICY}${report?.policyID ?? '-1'}`,
    selector: (policy: OnyxEntry<OnyxTypes.Policy>) => DistanceRequestUtils.getMileageRates(policy),
    },

    Once that is done -
    we can filter the disabled rate in IOURequestStepDistanceRate as following. and pass isDisabled value so it will show selected but style will be different for selected but disabled value.

        const sections = Object.values(rates).filter(rate => {
            const isSelected = currentRateID ? currentRateID === rate.customUnitRateID : rate.name === CONST.CUSTOM_UNITS.DEFAULT_RATE
            return isSelected || rate?.enabled
        }).map((rate) => {
            const rateForDisplay = DistanceRequestUtils.getRateForDisplay(rate.unit, rate.rate, rate.currency, translate, toLocaleDigit);
            return {
                text: rate.name ?? rateForDisplay,
                alternateText: rate.name ? rateForDisplay : '',
                keyForList: rate.customUnitRateID,
                value: rate.customUnitRateID,
                isSelected: currentRateID ? currentRateID === rate.customUnitRateID : rate.name === CONST.CUSTOM_UNITS.DEFAULT_RATE,
                isDisabled: !rate.enabled
            };
        });

    What alternative solutions did you explore? (Optional)

    demo -

    distance.rates.disabled.mp4
  6. neil-marcellini commented on Aug 6, 2024

    @neil-marcellini
    Contributor

    Not a blocker, the rate field is still behind the beta.

    image

  7. removed
    DeployBlockerCash
    on Aug 6, 2024
  8. 42 remaining items

  9. dylanexpensify commented on Sep 10, 2024

    @dylanexpensify
    Contributor

    pending regression period

  10. added and removed
    Weekly
    on Sep 16, 2024
  11. melvin-bot commented on Sep 16, 2024

    @melvin-bot

    This issue has not been updated in over 15 days. @iwiznia, @mananjadhav, @dylanexpensify, @dominictb 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!

  12. dominictb commented on Sep 18, 2024

    @dominictb
    Contributor

    Should be ready for payment shortly.

  13. mananjadhav commented on Sep 25, 2024

    @mananjadhav
    Collaborator

    @iwiznia Can you check if this was deployed to production? I don't see any automation message. This is the last comment.

  14. iwiznia commented on Sep 25, 2024

    @iwiznia
    Contributor

    FYI you can check yourself by looking at the production branch. I think it was since I see your changes here

  15. mananjadhav commented on Sep 25, 2024

    @mananjadhav
    Collaborator

    Okay I should've clarified. I did see the changes in the production branch, was wondering about the payout date. @dylanexpensify can you please help with the payout info? I'll work on the checklist meanwhile.

  16. iwiznia commented on Sep 25, 2024

    @iwiznia
    Contributor

    hmmm yeah, I am not sure. Maybe you can find the merge commit in the production branch?

  17. mananjadhav commented on Sep 26, 2024

    @mananjadhav
    Collaborator

    Correct me if I am wrong but we can use this release link to confirm this was deployed 2 weeks ago - https://github.com/Expensify/App/releases/tag/9.0.31-26

    @dylanexpensify as for the checklist I think this was more of an edge case and hence I don't have a PR that I can pinpoint to.

    But I do feel we should add a regression test for this one.

    Regression Test Proposal

    1. Precondition: Workspace has some distance rates.
    2. Go to NewDot app
    3. Go to workspace chat.
    4. Submit a distance expense with Distance rate A.
    5. Go to workspace settings > Distance rates.
    6. Disable Distance rate A used in Step 3.
    7. Go back to transaction thread of the distance expense.
    8. Click Rate.
    9. Verify that: The disabled rate will appear selected in the rate list but grayed out.
  18. dylanexpensify commented on Sep 26, 2024

    @dylanexpensify
    Contributor

    Payment summary:

    Contributor: @dominictb $250 via Upwork
    Contributor+: @mananjadhav $250 via NewDot

    Please apply/request!

  19. dylanexpensify commented on Sep 26, 2024

    @dylanexpensify
    Contributor

    payment sent in upwork @dominictb!

  20. garrettmknight commented on Oct 2, 2024

    @garrettmknight
    Contributor

    $250 approved for @mananjadhav

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

Metadata

Metadata

Labels

BugEngineeringExternalMonthlyReviewing

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions