Created
June 7, 2017 20:50
-
-
Save thomsbg/3cf8ec573f58c6bc2b0d59c1976d58c7 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
diff --git a/client/actions/groups.js b/client/actions/groups.js | |
index bc8e4f61d..175ce42bc 100644 | |
--- a/client/actions/groups.js | |
+++ b/client/actions/groups.js | |
@@ -36,11 +36,11 @@ export function getAllParents(group, groups) { | |
return [group]; | |
} | |
-function childrenOf(group, groups) { | |
- var children = sortBy(compact(group.child_entry_group_ids.map((id) => { | |
- return groups.find(group => group.id === id); | |
- })), 'name'); | |
- group.children = children; | |
+function childrenOf(parent, groups) { | |
+ var children = sortBy(groups.filter(group => { | |
+ return group.parent_entry_group_id == parent.id; | |
+ }), 'name'); | |
+ parent.children = children; | |
return children; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment