Skip to content

Commit

Permalink
Merge pull request #3202 from SEED-platform/3146-fix/apply-decimals-t…
Browse files Browse the repository at this point in the history
…o-extra-data

fix: fields marked 'number' also get rounded
  • Loading branch information
Ryo committed Apr 6, 2022
2 parents a59813a + 4ad15f4 commit 66df86d
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ angular.module('BE.seed.controller.inventory_cycles', [])
if (col.data_type === 'datetime') {
options.cellFilter = 'date:\'yyyy-MM-dd h:mm a\'';
options.filter = inventory_service.dateFilter();
} else if (col.data_type === 'eui' || col.data_type === 'area') {
} else if (['area', 'eui', 'float', 'number'].includes(col.data_type)) {
options.cellFilter = 'number: ' + $scope.organization.display_decimal_places;
options.filter = inventory_service.combinedFilter();
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,7 @@ angular.module('BE.seed.controller.inventory_detail', [])
$scope.displayValue = function (dataType, value) {
if (dataType === 'datetime') {
return $filter('date')(value, 'yyyy-MM-dd h:mm a');
} else if (dataType === 'eui' || dataType === 'area') {
} else if (['area', 'eui', 'float', 'number'].includes(dataType)) {
return $filter('number')(value, $scope.organization.display_decimal_places);
}
return value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ angular.module('BE.seed.controller.inventory_detail_cycles', [])
$scope.displayValue = function (dataType, value) {
if (dataType === 'datetime') {
return $filter('date')(value, 'yyyy-MM-dd h:mm a');
} else if (dataType === 'eui' || dataType === 'area') {
} else if (['area', 'eui', 'float', 'number'].includes(dataType)) {
return $filter('number')(value, $scope.organization.display_decimal_places);
}
return value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -566,9 +566,9 @@ angular.module('BE.seed.controller.inventory_list_beta', [])
// Modify misc
if (col.data_type === 'datetime') {
options.cellFilter = 'date:\'yyyy-MM-dd h:mm a\'';
} else if (col.data_type === 'eui' || col.data_type === 'area') {
} else if (['area', 'eui', 'float', 'number'].includes(col.data_type)) {
options.cellFilter = 'number: ' + $scope.organization.display_decimal_places;
} else if (col.data_type === 'float' || col.is_derived_column) {
} else if (col.is_derived_column) {
options.cellFilter = 'number: ' + $scope.organization.display_decimal_places;
}

Expand Down
4 changes: 2 additions & 2 deletions seed/static/seed/js/controllers/inventory_list_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -603,11 +603,11 @@ angular.module('BE.seed.controller.inventory_list', [])
options.filter = inventory_service.dateFilter();
} else if (col.data_type === 'date') {
options.filter = inventory_service.dateFilter();
} else if (col.data_type === 'eui' || col.data_type === 'area') {
} else if (['area', 'eui', 'float', 'number'].includes(col.data_type)) {
options.filter = inventory_service.combinedFilter();
options.cellFilter = 'number: ' + $scope.organization.display_decimal_places;
options.sortingAlgorithm = naturalSort;
} else if (col.data_type === 'float' || col.is_derived_column) {
} else if (col.is_derived_column) {
options.filter = inventory_service.combinedFilter();
options.cellFilter = 'number: ' + $scope.organization.display_decimal_places;
options.sortingAlgorithm = naturalSort;
Expand Down
2 changes: 1 addition & 1 deletion seed/static/seed/js/controllers/mapping_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -716,7 +716,7 @@ angular.module('BE.seed.controller.mapping', [])
if (col.data_type === 'datetime') {
options.cellFilter = 'date:\'yyyy-MM-dd h:mm a\'';
options.filter = inventory_service.dateFilter();
} else if (col.data_type === 'area' || col.data_type === 'eui') {
} else if (['area', 'eui', 'float', 'number'].includes(col.data_type)) {
options.cellFilter = 'number: ' + $scope.organization.display_decimal_places;
options.sortingAlgorithm = naturalSort;
} else {
Expand Down

0 comments on commit 66df86d

Please sign in to comment.