Merge pull request #3736 from furinvader/bugs/21857-broken-grouping

[21857] Wrong grouping by responsible in work package table
pull/3739/head
Oliver Günther 9 years ago
commit 7be1212494
  1. 11
      frontend/app/work_packages/helpers/work-packages-table-helper.js

@ -31,7 +31,7 @@ module.exports = function(WorkPackagesHelper) {
/* builds rows from work packages, see IssuesHelper */
buildRows: function(workPackages, groupBy) {
var rows = [], ancestors = [];
var currentGroup, allGroups = [], groupIndex = -1;
var currentGroup, allGroups = [];
angular.forEach(workPackages, function(workPackage, i) {
while(ancestors.length > 0 && workPackage.parent_id !== _.last(ancestors).object.id) {
@ -39,7 +39,6 @@ module.exports = function(WorkPackagesHelper) {
ancestors.pop();
}
// compose row
var row = {
@ -51,18 +50,18 @@ module.exports = function(WorkPackagesHelper) {
// 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) {
currentGroup = WorkPackagesHelper.getRowObjectContent(workPackage, groupBy);
if(allGroups.indexOf(currentGroup) === -1) {
allGroups.push(currentGroup);
groupIndex++;
}
angular.extend(row, {
groupIndex: groupIndex,
groupIndex: allGroups.indexOf(currentGroup),
groupName: currentGroup
});
}
@ -72,7 +71,7 @@ module.exports = function(WorkPackagesHelper) {
if (!workPackage['leaf?']) ancestors.push(row);
});
return rows;
return _.sortBy(rows, 'groupIndex');
},
allRowsChecked: function(rows) {

Loading…
Cancel
Save