Only store group information in row if data is grouped

pull/913/head
Till Breuer 11 years ago
parent ad97ca7632
commit 2870ae706c
  1. 30
      app/assets/javascripts/angular/helpers/work-packages-table-helper.js

@ -13,28 +13,34 @@ angular.module('openproject.workPackages.helpers')
ancestors.pop();
}
// 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
currentGroup = WorkPackagesHelper.getRowObjectContent(workPackage, groupBy);
if(allGroups.indexOf(currentGroup) === -1) {
allGroups.push(currentGroup);
groupIndex++;
}
// compose row
var row = {
level: ancestors.length,
groupIndex: groupIndex,
groupName: currentGroup,
parent: ancestors.last(),
ancestors: ancestors.slice(0),
object: workPackage
};
// 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
if (groupBy) {
currentGroup = WorkPackagesHelper.getRowObjectContent(workPackage, groupBy);
if(allGroups.indexOf(currentGroup) === -1) {
allGroups.push(currentGroup);
groupIndex++;
}
angular.extend(row, {
groupIndex: groupIndex,
groupName: currentGroup
});
}
rows.push(row);
if (!workPackage['leaf?']) ancestors.push(row);

Loading…
Cancel
Save