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-08-01] [$250] Workspace - The tag and category lists lack consistent alphabetical order #44922

Closed
1 of 6 tasks
lanitochka17 opened this issue Jul 5, 2024 · 27 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

@lanitochka17
Copy link

lanitochka17 commented Jul 5, 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: 9.0.4-5
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): dave0123seife+stest@gmail.com
Issue reported by: Applause - Internal Team

Action Performed:

  1. Go to workspace/or create one > Categories
  2. Click on Add category
  3. Now add Categories. Make some categories start with Capital letter and others with Small letter
    Notice that categories are listed Alphabetically with Capital letters coming first and then small letters.
  4. Repeat step 2 and 3 for Tags. (You might have to enable tags by going to more feature)
    Notice that tags are also listed the same way as Categories are listed.
  5. Go to the workspace chat > start submitting an expense
    6.Before submitting the expense Click on the show more
  6. Go to categories. Notice that here small letter comes first
  7. Go to tags. Notice small letters are show last below all the capital letters

Expected Result:

Consistent alphabetical order

Actual Result:

Inconsistent alphabetical order

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

Bug6533980_1720177825699.Ex_Alphabetical_Order_issue.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~013f0c5d89e0679c03
  • Upwork Job ID: 1810477124215778147
  • Last Price Increase: 2024-07-09
  • Automatic offers:
    • ishpaul777 | Reviewer | 103053435
    • dominictb | Contributor | 103053437
Issue OwnerCurrent Issue Owner: @VictoriaExpensify
@lanitochka17 lanitochka17 added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Jul 5, 2024
Copy link

melvin-bot bot commented Jul 5, 2024

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

@cretadn22
Copy link
Contributor

cretadn22 commented Jul 5, 2024

Proposal

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

Workspace - The tag and category lists lack consistent alphabetical order

What is the root cause of that problem?

We using different sort in two places: WorkspaceCategoriesPage and CategoryPicker

const sortedCategories = Object.values(categories).sort((a, b) => a.name.localeCompare(b.name));

.sort((a, b) => localeCompare(a.name, b.name))

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

If you want to display uppercase letters first, use this method

localeCompare(a.name, b.name)) 

If you want to display lowercase letters first, use this method

a.name.localeCompare(b.name))

What alternative solutions did you explore? (Optional)

Using lodashSortBy to ensure consistency with oldDot (display uppercase letters first)

Updated: Apply lodashSortBy to these places:

const sortedCategories = Object.values(categories).sort((a, b) => a.name.localeCompare(b.name));

acc.push(...nestedCategories.sort((a, b) => a.name.localeCompare(b.name)));

.sort((a, b) => localeCompare(a.name, b.name))

.sort((tagA, tagB) => localeCompare(tagA.name, tagB.name))

.sort((tagA, tagB) => localeCompare(tagA.name, tagB.name))

The places mentioned are specifically for tag and category pages. If we want to expand the use of lodashSortBy to cover all places, I can include more later.

@dominictb
Copy link
Contributor

Proposal

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

  • Inconsistent alphabetical order in tags and categories.

What is the root cause of that problem?

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

  • We need to find the proper sorting method and use it in the above positions. I think the sorting method:
    function sortTags(tags: Record<string, PolicyTag | SelectedTagOption> | Array<PolicyTag | SelectedTagOption>) {
    const sortedTags = Array.isArray(tags) ? tags : Object.values(tags);
    // Use lodash's sortBy to ensure consistency with oldDot.
    return lodashSortBy(sortedTags, 'name', localeCompare);
    }
    is the best because it was handled to match this requirement.
  • Based on the above choice, below is the implement steps:
  1. Update:
    const sortedCategories = Object.values(categories).sort((a, b) => a.name.localeCompare(b.name));

    to:
    const sortedCategories = lodashSortBy(Object.values(categories), 'name', localeCompare);
  1. Update:
    Object.values(policyCategories ?? {})
    .sort((a, b) => localeCompare(a.name, b.name))

    to:
            lodashSortBy(Object.values(policyCategories ?? {}), 'name', localeCompare).map((value) => {
  1. Update:
    return Object.values(policyTagLists[0]?.tags ?? {})
    .sort((tagA, tagB) => localeCompare(tagA.name, tagB.name))

    to:
        return lodashSortBy(Object.values(policyTagLists[0]?.tags ?? {}), 'name', localeCompare).map((tag) => ({

@melvin-bot melvin-bot bot added the Overdue label Jul 7, 2024
@VictoriaExpensify
Copy link
Contributor

I agree this is a bug that should be fixed, but I want to chat with the team about the desired behaviour here. I think Expensify Classic default everything to be capitalised and I have never come across anyone who wasn't happy with this, so I wonder if that is the best way to resolve the issue.

@melvin-bot melvin-bot bot removed the Overdue label Jul 7, 2024
@VictoriaExpensify
Copy link
Contributor

Alright, tested this in OldDot and it is inconsistent there, too 😅

I think we should get some design input on this one.

@VictoriaExpensify
Copy link
Contributor

Personally, I can't think of any reason why you would have a need for upper and lower case categories and tags. I kind of think we should default these all to be capitalised and, that way, you won't end up with two with the same name.

@VictoriaExpensify
Copy link
Contributor

Hmm actually, I would sorry this would break something with our integrations since Tags and Categories can be imported from there.

Generally, when listed alphabetically, the word with the capital letter comes first. So let's keep the platform consistent with that standard

@VictoriaExpensify VictoriaExpensify added the External Added to denote the issue can be worked on by a contributor label Jul 9, 2024
@melvin-bot melvin-bot bot changed the title Workspace - The tag and category lists lack consistent alphabetical order [$250] Workspace - The tag and category lists lack consistent alphabetical order Jul 9, 2024
Copy link

melvin-bot bot commented Jul 9, 2024

Job added to Upwork: https://www.upwork.com/jobs/~013f0c5d89e0679c03

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

melvin-bot bot commented Jul 9, 2024

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

@ishpaul777
Copy link
Contributor

ishpaul777 commented Jul 9, 2024

We have standardized on using the native Array instance methods instead of lodash methods for objects and collections. As the vast majority of code is written in TypeScript, we can safely use the native methods.

Quoting TS style guide we should prefer native Array instance methods instead of lodash

if we are ok with using lodash for sorting to maintain consistency with olddot, then we can assign @dominictb as they proposed it first


otherwhise nothing wrong with @cretadn22's proposal and use localeCompare(a.name, b.name)) in sortCategories and sortTags that should be enough.

🎀 👀 🎀 C+ reviewed

Copy link

melvin-bot bot commented Jul 9, 2024

Triggered auto assignment to @chiragsalian, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

@dominictb
Copy link
Contributor

@chiragsalian This bug is about "The tag and category lists lack consistent alphabetical order", so I think we need to fix the tags list as well, not just category

@ishpaul777
Copy link
Contributor

thanks for pointing that out @dominictb, you are correct! I have updated my recomendation 👍

@dominictb
Copy link
Contributor

@ishpaul777 This proposal was updated since 11hrs ago with the change that apply to tags list, that did not exist before.
Screenshot 2024-07-10 at 03 28 11

Can you help check again?

@ishpaul777
Copy link
Contributor

yes, i did check that i recommended @cretadn22 as they are the only one that propose to use localeCompare(a.name, b.name)) since you are the first that mention to update tag sorting (more important) i'll give you the first dibs 👍

@chiragsalian
Copy link
Contributor

Thanks for the discussion, let's go with @dominictb's proposal and use lodashSortBy. When using it can you add a comment explaining why we are using lodash with a link to this so that its not forgotten. Feel free to create a PR.

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

melvin-bot bot commented Jul 9, 2024

📣 @ishpaul777 🎉 An offer has been automatically sent to your Upwork account for the Reviewer role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job

Copy link

melvin-bot bot commented Jul 9, 2024

📣 @dominictb 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job
Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
Keep in mind: Code of Conduct | Contributing 📖

@dominictb
Copy link
Contributor

PR #45236 is ready

@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 25, 2024
@melvin-bot melvin-bot bot changed the title [$250] Workspace - The tag and category lists lack consistent alphabetical order [HOLD for payment 2024-08-01] [$250] Workspace - The tag and category lists lack consistent alphabetical order Jul 25, 2024
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Jul 25, 2024
Copy link

melvin-bot bot commented Jul 25, 2024

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

Copy link

melvin-bot bot commented Jul 25, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.11-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-08-01. 🎊

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

Copy link

melvin-bot bot commented Jul 25, 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:

  • [@ishpaul777] The PR that introduced the bug has been identified. Link to the PR:
  • [@ishpaul777] 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:
  • [@ishpaul777] 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:
  • [@ishpaul777] Determine if we should create a regression test for this bug.
  • [@ishpaul777] 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.
  • [@VictoriaExpensify] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@melvin-bot melvin-bot bot added Daily KSv2 Overdue and removed Weekly KSv2 labels Jul 31, 2024
@chiragsalian
Copy link
Contributor

Not overdue melvin, on hold for payment

@VictoriaExpensify
Copy link
Contributor

@ishpaul777 - I'll organise payment once you have complete the checklist

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Aug 2, 2024
@ishpaul777
Copy link
Contributor

[@ishpaul777] The PR that introduced the bug has been identified. Link to the PR: #37704
[@ishpaul777] 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: https://github.com/Expensify/App/pull/37704/files#r1704192128
[@ishpaul777] 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
[@ishpaul777] Determine if we should create a regression test for this bug. - No need
[@ishpaul777] 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. N/A

Copy link

melvin-bot bot commented Aug 5, 2024

@chiragsalian, @VictoriaExpensify, @ishpaul777, @dominictb Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@VictoriaExpensify
Copy link
Contributor

Payment Summary:

Contributor: @dominictb paid $250 [via Upwork](Upwork job)
Contributor+: @ishpaul777 paid $250 [via Upwork](Upwork job)

Thanks for your work on this bug!

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
Status: Done
Development

No branches or pull requests

6 participants