-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Fix incorrect ordering of subcategories #29281
Merged
puneetlath
merged 24 commits into
Expensify:main
from
rezkiy37:fix/28964-incorrect-ordering-subcategories
Oct 24, 2023
Merged
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
7f3e6c8
improve getCategoryOptionTree
rezkiy37 bc9b952
add one-line test case
rezkiy37 7ac0ec5
fix keys
rezkiy37 99da058
Merge branch 'main' of https://github.com/rezkiy37/Expensify into fix…
rezkiy37 2f3c120
Merge branch 'main' of https://github.com/rezkiy37/Expensify into fix…
rezkiy37 10a5788
single responsibility of filtering disabled categories
rezkiy37 c21dc53
create sortCategories helper
rezkiy37 638837e
use sortCategories helper
rezkiy37 44b45a5
Merge branch 'main' of https://github.com/rezkiy37/Expensify into fix…
rezkiy37 ad432b1
minor grammar fix
rezkiy37 443cc02
Merge branch 'main' of https://github.com/rezkiy37/Expensify into fix…
rezkiy37 1c447e2
improvements
rezkiy37 af7007d
Merge branch 'main' of https://github.com/rezkiy37/Expensify into fix…
rezkiy37 9fa9bca
add comments
rezkiy37 21a25fa
handle a case with dots in category name
rezkiy37 e297e5f
Merge branch 'main' of https://github.com/rezkiy37/Expensify into fix…
rezkiy37 0f8cfb5
clean the dot within category name solution
rezkiy37 e70e40b
add one more case
rezkiy37 8269bab
Merge branch 'main' of https://github.com/rezkiy37/Expensify into fix…
rezkiy37 354b515
sort top-level category
rezkiy37 8a31777
expect sorted categories
rezkiy37 87c35b8
Merge branch 'main' of https://github.com/rezkiy37/Expensify into fix…
rezkiy37 015cc04
sort via underscore
rezkiy37 411db80
use array instead of string in lodashGet
rezkiy37 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You used
_.reduce
a few lines later, maybe this would be a bit cleaner if we used reduction instead of mutating thehierarchy
object?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I use the reduction to covert the
hierarchy
object into a sorted array. Before the reduction, we need do 2 actions:hierarchy
object. It helps sort subcategories, keep them uniquely and store initial names.So, I don't see a variant how to combine these 2 different functions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just meant that the
hierarchy
itself could probably also be built in a mostly functionally-pure wayThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmm... Could you please share an example?
It is a simple loop right now, where the app sets values one by one. I don't see any concerns with functional programming patterns here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okey, let's leave this. I agree that the code is acceptable as-is.