|
|
@ -31,7 +31,7 @@ module.exports = function(WorkPackagesHelper) { |
|
|
|
/* builds rows from work packages, see IssuesHelper */ |
|
|
|
/* builds rows from work packages, see IssuesHelper */ |
|
|
|
buildRows: function(workPackages, groupBy) { |
|
|
|
buildRows: function(workPackages, groupBy) { |
|
|
|
var rows = [], ancestors = []; |
|
|
|
var rows = [], ancestors = []; |
|
|
|
var currentGroup, allGroups = [], groupIndex = -1; |
|
|
|
var currentGroup, allGroups = []; |
|
|
|
|
|
|
|
|
|
|
|
angular.forEach(workPackages, function(workPackage, i) { |
|
|
|
angular.forEach(workPackages, function(workPackage, i) { |
|
|
|
while(ancestors.length > 0 && workPackage.parent_id !== _.last(ancestors).object.id) { |
|
|
|
while(ancestors.length > 0 && workPackage.parent_id !== _.last(ancestors).object.id) { |
|
|
@ -39,7 +39,6 @@ module.exports = function(WorkPackagesHelper) { |
|
|
|
ancestors.pop(); |
|
|
|
ancestors.pop(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// compose row
|
|
|
|
// compose row
|
|
|
|
|
|
|
|
|
|
|
|
var row = { |
|
|
|
var row = { |
|
|
@ -51,18 +50,18 @@ module.exports = function(WorkPackagesHelper) { |
|
|
|
|
|
|
|
|
|
|
|
// manage groups
|
|
|
|
// manage groups
|
|
|
|
|
|
|
|
|
|
|
|
// this helper method assumes that the work packages are passed in in blocks each of which consisting of work packages which belong to one group
|
|
|
|
// this helper method assumes that the work packages are passed in in blocks
|
|
|
|
|
|
|
|
// each of which consisting of work packages which belong to one group
|
|
|
|
|
|
|
|
|
|
|
|
if (groupBy) { |
|
|
|
if (groupBy) { |
|
|
|
currentGroup = WorkPackagesHelper.getRowObjectContent(workPackage, groupBy); |
|
|
|
currentGroup = WorkPackagesHelper.getRowObjectContent(workPackage, groupBy); |
|
|
|
|
|
|
|
|
|
|
|
if(allGroups.indexOf(currentGroup) === -1) { |
|
|
|
if(allGroups.indexOf(currentGroup) === -1) { |
|
|
|
allGroups.push(currentGroup); |
|
|
|
allGroups.push(currentGroup); |
|
|
|
groupIndex++; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
angular.extend(row, { |
|
|
|
angular.extend(row, { |
|
|
|
groupIndex: groupIndex, |
|
|
|
groupIndex: allGroups.indexOf(currentGroup), |
|
|
|
groupName: currentGroup |
|
|
|
groupName: currentGroup |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
@ -72,7 +71,7 @@ module.exports = function(WorkPackagesHelper) { |
|
|
|
if (!workPackage['leaf?']) ancestors.push(row); |
|
|
|
if (!workPackage['leaf?']) ancestors.push(row); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
return rows; |
|
|
|
return _.sortBy(rows, 'groupIndex'); |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
allRowsChecked: function(rows) { |
|
|
|
allRowsChecked: function(rows) { |
|
|
|