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-07-26] [$250] Features in Workspace LHN are not in the same order as in "More Features" #45549

Closed
6 tasks done
yuwenmemon opened this issue Jul 17, 2024 · 26 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 External Added to denote the issue can be worked on by a contributor

Comments

@yuwenmemon
Copy link
Contributor

yuwenmemon commented Jul 17, 2024

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.5-12
Reproducible in staging?: Y
Reproducible in production?: Y
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): All
Logs: N/A
Expensify/Expensify Issue URL:
Issue reported by: @zsgreenwald
Slack conversation: https://expensify.slack.com/archives/C06ML6X0W9L/p1721165288016089

Action Performed:

  1. Go to a workspace
  2. Turn on all features in under "More features"
  3. They should all appear in the LHN for the workspace
  4. Observe that the order they are in does not match what's in "More features"

Expected Result:

The order of the items in the LHN should be in the same order as they are in "More features"

Actual Result:

The order of the items does not match the order in "More features"

Workaround:

Yes, this is a small polish bug.

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

Screenshot 2024-07-16 at 3 23 22 PM

Screenshot 2024-07-16 at 6 05 48 PM

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~019d9f00389c515c84
  • Upwork Job ID: 1813380721244668134
  • Last Price Increase: 2024-07-17
Issue OwnerCurrent Issue Owner: @OfstadC
@yuwenmemon yuwenmemon added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor labels Jul 17, 2024
Copy link

melvin-bot bot commented Jul 17, 2024

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

@yuwenmemon yuwenmemon assigned yuwenmemon and unassigned OfstadC Jul 17, 2024
@melvin-bot melvin-bot bot changed the title Features in Workspace LHN are not in the same order as in "More Features" [$250] Features in Workspace LHN are not in the same order as in "More Features" Jul 17, 2024
Copy link

melvin-bot bot commented Jul 17, 2024

Job added to Upwork: https://www.upwork.com/jobs/~019d9f00389c515c84

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Jul 17, 2024
Copy link

melvin-bot bot commented Jul 17, 2024

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

@Krishna2323
Copy link
Contributor

Krishna2323 commented Jul 17, 2024

Proposal

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

Features in Workspace LHN are not in the same order as in "More Features"

What is the root cause of that problem?

Accounting field is placed before Report Fields

if (featureStates?.[CONST.POLICY.MORE_FEATURES.ARE_CONNECTIONS_ENABLED]) {
protectedCollectPolicyMenuItems.push({
translationKey: 'workspace.common.accounting',
icon: Expensicons.Sync,
action: singleExecution(waitForNavigate(() => Navigation.navigate(ROUTES.POLICY_ACCOUNTING.getRoute(policyID)))),
// brickRoadIndicator should be set when API will be ready
brickRoadIndicator: undefined,
routeName: SCREENS.WORKSPACE.ACCOUNTING.ROOT,
});
}
if (featureStates?.[CONST.POLICY.MORE_FEATURES.ARE_REPORT_FIELDS_ENABLED]) {
protectedCollectPolicyMenuItems.push({
translationKey: 'workspace.common.reportFields',
icon: Expensicons.Pencil,
action: singleExecution(waitForNavigate(() => Navigation.navigate(ROUTES.WORKSPACE_REPORT_FIELDS.getRoute(policyID)))),
routeName: SCREENS.WORKSPACE.REPORT_FIELDS,
});
}

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

Place Accounting field is after Report Fields.

  
 if (featureStates?.[CONST.POLICY.MORE_FEATURES.ARE_REPORT_FIELDS_ENABLED]) { 
     protectedCollectPolicyMenuItems.push({ 
         translationKey: 'workspace.common.reportFields', 
         icon: Expensicons.Pencil, 
         action: singleExecution(waitForNavigate(() => Navigation.navigate(ROUTES.WORKSPACE_REPORT_FIELDS.getRoute(policyID)))), 
         routeName: SCREENS.WORKSPACE.REPORT_FIELDS, 
     }); 
 } 

 if (featureStates?.[CONST.POLICY.MORE_FEATURES.ARE_CONNECTIONS_ENABLED]) { 
     protectedCollectPolicyMenuItems.push({ 
         translationKey: 'workspace.common.accounting', 
         icon: Expensicons.Sync, 
         action: singleExecution(waitForNavigate(() => Navigation.navigate(ROUTES.POLICY_ACCOUNTING.getRoute(policyID)))), 
         // brickRoadIndicator should be set when API will be ready 
         brickRoadIndicator: undefined, 
         routeName: SCREENS.WORKSPACE.ACCOUNTING.ROOT, 
     }); 
 } 

What alternative solutions did you explore? (Optional)

POC:
image

@yuwenmemon
Copy link
Contributor Author

Thanks @Krishna2323 looks good.

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Jul 17, 2024
Copy link

melvin-bot bot commented Jul 17, 2024

❌ There was an error making the offer to @Krishna2323 for the Contributor role. The BZ member will need to manually hire the contributor.

@nkdengineer
Copy link
Contributor

Proposal

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

The order of the items does not match the order in "More features"

What is the root cause of that problem?

We push the accounting option before the report field option

if (featureStates?.[CONST.POLICY.MORE_FEATURES.ARE_CONNECTIONS_ENABLED]) {

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

To make the code cleaner, we can create a collectMenuItems that contains all feature items

const collectMenuItems: Record<PolicyFeatureName,WorkspaceMenuItem> = {
    [CONST.POLICY.MORE_FEATURES.ARE_DISTANCE_RATES_ENABLED]: {
        translationKey: 'workspace.common.distanceRates',
        icon: Expensicons.Car,
        action: singleExecution(waitForNavigate(() => Navigation.navigate(ROUTES.WORKSPACE_DISTANCE_RATES.getRoute(policyID)))),
        routeName: SCREENS.WORKSPACE.DISTANCE_RATES,
    },
    [CONST.POLICY.MORE_FEATURES.ARE_WORKFLOWS_ENABLED]: {
        translationKey: 'workspace.common.workflows',
        icon: Expensicons.Workflows,
        action: singleExecution(waitForNavigate(() => Navigation.navigate(ROUTES.WORKSPACE_WORKFLOWS.getRoute(policyID)))),
        routeName: SCREENS.WORKSPACE.WORKFLOWS,
        brickRoadIndicator: !isEmptyObject(policy?.errorFields?.reimburser ?? {}) ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined,
    },
    [CONST.POLICY.MORE_FEATURES.ARE_CATEGORIES_ENABLED]: {
        translationKey: 'workspace.common.categories',
        icon: Expensicons.Folder,
        action: singleExecution(waitForNavigate(() => Navigation.navigate(ROUTES.WORKSPACE_CATEGORIES.getRoute(policyID)))),
        brickRoadIndicator: hasPolicyCategoryError ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined,
        routeName: SCREENS.WORKSPACE.CATEGORIES,
    },
    [CONST.POLICY.MORE_FEATURES.ARE_TAGS_ENABLED]: {
        translationKey: 'workspace.common.tags',
        icon: Expensicons.Tag,
        action: singleExecution(waitForNavigate(() => Navigation.navigate(ROUTES.WORKSPACE_TAGS.getRoute(policyID)))),
        routeName: SCREENS.WORKSPACE.TAGS,
    },
    [CONST.POLICY.MORE_FEATURES.ARE_TAXES_ENABLED]: {
        translationKey: 'workspace.common.taxes',
        icon: Expensicons.Coins,
        action: singleExecution(waitForNavigate(() => Navigation.navigate(ROUTES.WORKSPACE_TAXES.getRoute(policyID)))),
        routeName: SCREENS.WORKSPACE.TAXES,
        brickRoadIndicator: PolicyUtils.hasTaxRateError(policy) ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined,
    },
    [CONST.POLICY.MORE_FEATURES.ARE_CONNECTIONS_ENABLED]: {
        translationKey: 'workspace.common.accounting',
        icon: Expensicons.Sync,
        action: singleExecution(waitForNavigate(() => Navigation.navigate(ROUTES.POLICY_ACCOUNTING.getRoute(policyID)))),
        // brickRoadIndicator should be set when API will be ready
        brickRoadIndicator: undefined,
        routeName: SCREENS.WORKSPACE.ACCOUNTING.ROOT,
    },
    [CONST.POLICY.MORE_FEATURES.ARE_EXPENSIFY_CARDS_ENABLED]: {
        translationKey: 'workspace.common.expensifyCard',
        icon: Expensicons.CreditCard,
        action: singleExecution(waitForNavigate(() => Navigation.navigate(ROUTES.WORKSPACE_EXPENSIFY_CARD.getRoute(policyID)))),
        routeName: SCREENS.WORKSPACE.EXPENSIFY_CARD,
    },
    [CONST.POLICY.MORE_FEATURES.ARE_REPORT_FIELDS_ENABLED]: {
        translationKey: 'workspace.common.reportFields',
        icon: Expensicons.Pencil,
        action: singleExecution(waitForNavigate(() => Navigation.navigate(ROUTES.WORKSPACE_REPORT_FIELDS.getRoute(policyID)))),
        routeName: SCREENS.WORKSPACE.REPORT_FIELDS,
    },
}

And then get protectedCollectPolicyMenuItems by getting the feature that is enabled in collectMenuItems. With this change, we can remove all if conditions that we used to push the feature item.

const protectedCollectPolicyMenuItems: WorkspaceMenuItem[] = (Object.keys(featureStates ?? {}) as PolicyFeatureName[]).filter((featureKey) => featureStates[featureKey]).map((featureKey) => {
    return collectMenuItems[featureKey];
});

After that, we only need to re-order the feature here

const policyFeatureStates = useMemo(
    () => ({
        [CONST.POLICY.MORE_FEATURES.ARE_DISTANCE_RATES_ENABLED]: policy?.areDistanceRatesEnabled,
        [CONST.POLICY.MORE_FEATURES.ARE_EXPENSIFY_CARDS_ENABLED]: policy?.areExpensifyCardsEnabled,
        [CONST.POLICY.MORE_FEATURES.ARE_WORKFLOWS_ENABLED]: policy?.areWorkflowsEnabled,
        [CONST.POLICY.MORE_FEATURES.ARE_CATEGORIES_ENABLED]: policy?.areCategoriesEnabled,
        [CONST.POLICY.MORE_FEATURES.ARE_TAGS_ENABLED]: policy?.areTagsEnabled,
        [CONST.POLICY.MORE_FEATURES.ARE_TAXES_ENABLED]: policy?.tax?.trackingEnabled,
        [CONST.POLICY.MORE_FEATURES.ARE_REPORT_FIELDS_ENABLED]: policy?.areReportFieldsEnabled,
        [CONST.POLICY.MORE_FEATURES.ARE_CONNECTIONS_ENABLED]: policy?.areConnectionsEnabled,
    }),
    [policy],
) as PolicyFeatureStates;

const policyFeatureStates = useMemo(

What alternative solutions did you explore? (Optional)

@nkdengineer
Copy link
Contributor

@yuwenmemon Sorry for the late, can you please take a look at my proposal here? That can make the code cleaner and we only need to re-order in policyFeatureStates which is easier to keep track.

@kaushiktd
Copy link
Contributor

@yuwenmemon I noticed that in my application currently "report field" feature not show as in you. Could you please guide me on how i get it
Screenshot 2024-07-17 at 10 29 29 AM

@Krishna2323
Copy link
Contributor

@yuwenmemon @sobitneupane, PR ready for review.

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Jul 19, 2024
@melvin-bot melvin-bot bot changed the title [$250] Features in Workspace LHN are not in the same order as in "More Features" [HOLD for payment 2024-07-26] [$250] Features in Workspace LHN are not in the same order as in "More Features" Jul 19, 2024
Copy link

melvin-bot bot commented Jul 19, 2024

Reviewing label has been removed, please complete the "BugZero Checklist".

@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Jul 19, 2024
Copy link

melvin-bot bot commented Jul 19, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.9-5 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

If no regressions arise, payment will be issued on 2024-07-26. 🎊

For reference, here are some details about the assignees on this issue:

Copy link

melvin-bot bot commented Jul 19, 2024

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.
  • [@OfstadC] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@OfstadC
Copy link
Contributor

OfstadC commented Jul 26, 2024

Adding @CortneyOfstad in since this needs a manual offer and i'm out today

@CortneyOfstad
Copy link
Contributor

@sobitneupane please complete the checklist as soon as possible, so there is no delay in payment — thank you!

@Krishna2323 — I sent you an offer in Upwork, please let me know once you accept and I can get that paid ASAP. Thank you!

@Krishna2323
Copy link
Contributor

@CortneyOfstad accepted, thanks.

@CortneyOfstad
Copy link
Contributor

Thanks @Krishna2323 – contract paid!

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Jul 26, 2024
Copy link

melvin-bot bot commented Jul 26, 2024

Payment Summary

Upwork Job

BugZero Checklist (@CortneyOfstad)

  • I have verified the correct assignees and roles are listed above and updated the neccesary manual offers
  • I have verified that there are no duplicate or incorrect contracts on Upwork for this job (https://www.upwork.com/ab/applicants/1813380721244668134/hired)
  • I have paid out the Upwork contracts or cancelled the ones that are incorrect
  • I have verified the payment summary above is correct

@sobitneupane
Copy link
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:

#43896 and #43943

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

#43896 (comment) and #43943 (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:

Not required.

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

@sobitneupane
Copy link
Contributor

Regression Test Proposal:

  1. Go to a workspace
  2. Turn on all features in under "More features"
  3. They should all appear in the LHN for the workspace
  4. Verify that the order of the items in the LHN is in the same order as they are in "More features"

Do we agree 👍 or 👎

@yuwenmemon
Copy link
Contributor Author

Looks great @sobitneupane

Copy link

melvin-bot bot commented Jul 29, 2024

@yuwenmemon, @CortneyOfstad, @OfstadC, @sobitneupane, @Krishna2323 Whoops! This issue is 2 days overdue. Let's get this updated quick!

@OfstadC
Copy link
Contributor

OfstadC commented Jul 30, 2024

Thanks @sobitneupane !

@melvin-bot melvin-bot bot removed the Overdue label Jul 30, 2024
@OfstadC
Copy link
Contributor

OfstadC commented Jul 30, 2024

https://github.com/Expensify/Expensify/issues/416301

@CortneyOfstad can you please finish the payment while i'm OoO today

@CortneyOfstad
Copy link
Contributor

Payment Summary

@Krishna2323 — paid $250 via Upwork
@sobitneupane — to be paid $250 via NewDot

@JmillsExpensify
Copy link

$250 approved for @sobitneupane

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 External Added to denote the issue can be worked on by a contributor
Projects
None yet
Development

No branches or pull requests

8 participants