Skip to content

Commit

Permalink
Fix #4361
Browse files Browse the repository at this point in the history
  • Loading branch information
haneslinger committed Jan 9, 2024
1 parent 2f24661 commit e30a764
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions seed/static/seed/js/controllers/mapping_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -598,15 +598,24 @@ angular.module('BE.seed.controller.mapping', []).controller('mapping_controller'
/**
* empty_units_present: used to disable or enable the 'Map Your Data' button if any units are empty
*/
$scope.empty_units_present = () => Boolean(_.find($scope.mappings, (field) => field.suggestion_table_name === 'PropertyState' && field.from_units === null && ($scope.is_area_column(field) || $scope.is_eui_column(field))));
$scope.empty_units_present = () => {
return $scope.mappings.some((field) => (
!field.isOmitted &&
field.suggestion_table_name === 'PropertyState' &&
field.from_units === null &&
($scope.is_area_column(field) || $scope.is_eui_column(field))
))
};

/**
* empty_fields_present: used to disable or enable the 'show & review
* mappings' button. No warning associated as users "aren't done" listing their mapping settings.
*/
const suggestions_not_provided_yet = () => {
const no_suggestion_value = Boolean(_.find($scope.mappings, { suggestion: undefined }));
const no_suggestion_table_name = Boolean(_.find($scope.mappings, { suggestion_table_name: undefined }));
const non_omitted_mappings = $scope.mappings.filter(m => !m.isOmitted)
const no_suggestion_value = Boolean(_.find(non_omitted_mappings, { suggestion: undefined }));
const no_suggestion_table_name = Boolean(_.find(non_omitted_mappings, { suggestion_table_name: undefined }));

return no_suggestion_value || no_suggestion_table_name;
};

Expand Down

0 comments on commit e30a764

Please sign in to comment.