Commit 468d4683 authored by Florie Guibert's avatar Florie Guibert

View closed issues in epic

parent c11d8c81
...@@ -30,6 +30,14 @@ export const sortChildren = (childA, childB) => childA.relativePosition - childB ...@@ -30,6 +30,14 @@ export const sortChildren = (childA, childB) => childA.relativePosition - childB
const stateOrder = ['opened', 'closed']; const stateOrder = ['opened', 'closed'];
export const sortByState = (a, b) => stateOrder.indexOf(a.state) - stateOrder.indexOf(b.state); export const sortByState = (a, b) => stateOrder.indexOf(a.state) - stateOrder.indexOf(b.state);
/**
* Returns sorted array, using sortChildren and sortByState
* Used to sort epics and issues
*
* @param {Array} items
*/
export const applySorts = array => array.sort(sortChildren).sort(sortByState);
/** /**
* Returns formatted child item to include additional * Returns formatted child item to include additional
* flags and properties to use while rendering tree. * flags and properties to use while rendering tree.
...@@ -85,11 +93,9 @@ export const extractChildIssues = issues => ...@@ -85,11 +93,9 @@ export const extractChildIssues = issues =>
* Parses Graph query response and updates * Parses Graph query response and updates
* children array to include issues within it * children array to include issues within it
* and then sorts everything based on `relativePosition` * and then sorts everything based on `relativePosition`
* and state
* *
* @param {Object} responseRoot * @param {Object} responseRoot
*/ */
export const processQueryResponse = ({ epic }) => export const processQueryResponse = ({ epic }) =>
[] applySorts([...extractChildEpics(epic.children), ...extractChildIssues(epic.issues)]);
.concat(extractChildEpics(epic.children), extractChildIssues(epic.issues))
.sort(sortChildren)
.sort(sortByState);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment