<commit_before>app.controller('dashboardController', function(dashboardSettings, $scope, dataPackage) {
  $scope.groups = [];
  dashboardSettings.setSettingsfromRouteParams();

  dataPackage.onChange(function(data, groupsToShow) {
    $scope.groups = groupsToShow;
  });

  $scope.isMultiColumn = function() {
    return dashboardSettings.getValue('multiColumn');
  };
});

app.filter('multiColumnXof2', function(dashboardSettings) {

  function minimumIndex(list) {
    var minIndex = 0;
    var minValue = list[0] | 0;
    list.forEach(function(value, index) {
      if (value < minValue) {
        minValue = value;
        minIndex = index;
      }
    });
    return minIndex;
  }

  // rough ratios based of css styles
  function getGroupHeight(group) {
    var height = 0;
    if (group.site || group.server) {
      height += 5;
    }
    if (group.features.length > 0) {
      height += 3 + 3 * Math.ceil(group.features.length / 2);
      if(group.isOtherGroup) {
        // "features" heading does not get displayed
        height -= 3;
      }
    }
    if (group.dependencies.length > 0) {
      height += 3 + 3 * Math.ceil(group.dependencies.length / 2);
    }
    return height;
  }

  return function(groups, columnNumber) {
    var columnHeights = [0, 0];
    var groupsInColumn = [];

    groups.forEach(function(group) {
      var destinationColumn = minimumIndex(columnHeights);
      columnHeights[destinationColumn] += getGroupHeight(group);

      if (destinationColumn + 1 === columnNumber) {
        groupsInColumn.push(group);
      }
    });

    return groupsInColumn;
  };
});<commit_msg>Minor improvement to height calculation for creating columns<commit_after>app.controller('dashboardController', function(dashboardSettings, $scope, dataPackage) {
  $scope.groups = [];
  dashboardSettings.setSettingsfromRouteParams();

  dataPackage.onChange(function(data, groupsToShow) {
    $scope.groups = groupsToShow;
  });

  $scope.isMultiColumn = function() {
    return dashboardSettings.getValue('multiColumn');
  };
});

app.filter('multiColumnXof2', function(dashboardSettings) {

  function minimumIndex(list) {
    var minIndex = 0;
    var minValue = list[0] | 0;
    list.forEach(function(value, index) {
      if (value < minValue) {
        minValue = value;
        minIndex = index;
      }
    });
    return minIndex;
  }

  // rough ratios based of css styles
  function getGroupHeight(group) {
    var height = 2;
    if (group.site || group.server) {
      height += 5;
    }
    if (group.features.length > 0) {
      height += 3 + 3 * Math.ceil(group.features.length / 2);
      if (group.isOtherGroup) {
        // "features" heading does not get displayed
        height -= 3;
      }
    }
    if (group.dependencies.length > 0) {
      height += 3 + 3 * Math.ceil(group.dependencies.length / 2);
    }
    return height;
  }

  return function(groups, columnNumber) {
    var columnHeights = [0, 0];
    var groupsInColumn = [];
    groups.forEach(function(group) {
      var destinationColumn = minimumIndex(columnHeights);
      columnHeights[destinationColumn] += getGroupHeight(group);

      if (destinationColumn + 1 === columnNumber) {
        groupsInColumn.push(group);
      }
    });

    return groupsInColumn;
  };
});
{'fraction_non_alphanumeric': 0.1280878316559927, 'fraction_numerical': 0.010978956999085087, 'mean_word_length': 2.9140811455847255, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '947782', 'n_tokens_mistral': 1016, 'n_tokens_neox': 968, 'n_words': 210}