Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix(Aggregation): Refactor introduced bug
Tests were failing and I did not notice. The function stopped returning
the actual values but was returning the aggregation text instead.
  • Loading branch information
c0bra committed Dec 5, 2014
1 parent d526874 commit a54c663
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/js/core/factories/GridColumn.js
Expand Up @@ -638,26 +638,26 @@ angular.module('ui.grid')
return self.aggregationType(visibleRows, self);
}
else if (self.aggregationType === uiGridConstants.aggregationTypes.count) {
return self.getAggregationText('aggregation.count', self.grid.getVisibleRowCount());
return self.grid.getVisibleRowCount();
}
else if (self.aggregationType === uiGridConstants.aggregationTypes.sum) {
angular.forEach(cellValues(), function (value) {
result += value;
});
return self.getAggregationText('aggregation.sum', result);
return result;
}
else if (self.aggregationType === uiGridConstants.aggregationTypes.avg) {
angular.forEach(cellValues(), function (value) {
result += value;
});
result = result / cellValues().length;
return self.getAggregationText('aggregation.avg', result);
return result;
}
else if (self.aggregationType === uiGridConstants.aggregationTypes.min) {
return self.getAggregationText('aggregation.min', Math.min.apply(null, cellValues()));
return Math.min.apply(null, cellValues());
}
else if (self.aggregationType === uiGridConstants.aggregationTypes.max) {
return self.getAggregationText('aggregation.max', Math.max.apply(null, cellValues()));
return Math.max.apply(null, cellValues());
}
else {
return '\u00A0';
Expand Down

0 comments on commit a54c663

Please sign in to comment.