Merge pull request #974 from opf/fix/timelines-second-level-grouping-4887

Fix/timelines second level grouping 4887
pull/1415/head
Jan Sandbrink 11 years ago
commit 35c34baecc
  1. 31
      app/assets/javascripts/timelines.js
  2. 1
      doc/CHANGELOG.md

@ -504,29 +504,22 @@ jQuery.extend(Timeline, {
var listToRemove = [];
// for all projects on the first level
jQuery.each(root.getReporters(), function (i, e) {
jQuery.each(root.getReporters(), function (i, reporter) {
// find all projects that are associated
jQuery.each(associations, function (j, a) {
jQuery.each(associations, function (j, association) {
if (a.involves(e)) {
var other = a.getOther(e);
// check if the reporter is involved and hasn't already been included by a second level grouping adjustment
if (!reporter.hasSecondLevelGroupingAdjustment && association.involves(reporter)) {
var other = association.getOther(reporter);
if (typeof other.getProjectType === "function") {
var pt = other.getProjectType();
var type = pt !== null ? pt.id : -1;
var projectType = other.getProjectType();
var projectTypeId = projectType !== null ? projectType.id : -1;
//check if the type is selected as 2nd level grouping
var relevant = false;
jQuery.each(grouping, function(k, l) {
if (l === type) {
relevant = true;
}
});
if (relevant) {
if (grouping.indexOf(projectTypeId) !== -1) {
// add the other project as a simulated reporter to the current one.
e.addReporter(other);
reporter.addReporter(other);
other.hasSecondLevelGroupingAdjustment = true;
// remove the project from the root level of the report.
listToRemove.push(other);
@ -538,8 +531,8 @@ jQuery.extend(Timeline, {
});
// remove all children of root that we couldn't remove while still iterating.
jQuery.each(listToRemove, function(i, e) {
root.removeReporter(e);
jQuery.each(listToRemove, function(i, reporter) {
root.removeReporter(reporter);
});
}
});
@ -651,7 +644,7 @@ jQuery.extend(Timeline, {
}
var i, selection = this.options.grouping_one_selection;
var p, groups = [], children;
if (this.isGrouping()) {
if (this.isGrouping() && selection) {
for ( i = 0; i < selection.length; i++ ) {
p = this.getProject(selection[i]);
if (p === undefined) {

@ -36,6 +36,7 @@ See doc/COPYRIGHT.rdoc for more details.
* `#4296` Adapt new workpackage form layout
* `#4793` Fix: [Search] Current project scope not shown
* `#4858` XSS in wp auto-completion
* `#4887` Second grouping criterion seems to have an and conjunction
* Added pry-byebug for ruby 2.1
* Allows redirecting to a back url on version#update

Loading…
Cancel
Save