diff --git a/CHANGELOG.md b/CHANGELOG.md index 86cfbdddfb..4114c3e84f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # SEED Version 2.20.0 - + ## What's Changed ### New Features ๐ŸŽ‰ @@ -18,6 +18,8 @@ * Update default meter range selection for BETTER analysis by @perryr16 in https://github.com/SEED-platform/seed/pull/3819 * Add a cycle indicator to the analysis modal and filter analyses for current cycle by @perryr16 in https://github.com/SEED-platform/seed/pull/3837 * Add envvar to specify loading test EEEJ dataset by @kflemin in https://github.com/SEED-platform/seed/pull/4254 +* Default to excluding Address Line 1 as a matching criteria by @axelstudios in https://github.com/SEED-platform/seed/pull/4256 +* Refactor map page for functionality and performance by @axelstudios in https://github.com/SEED-platform/seed/pull/4260 ### Maintenance ๐Ÿงน * Remove Deprecated APIs by @axelstudios in https://github.com/SEED-platform/seed/pull/4049 * Lock `google-chrome` to v114 by @axelstudios in https://github.com/SEED-platform/seed/pull/4165 @@ -26,6 +28,7 @@ * Bump uwsgi from 2.0.17.1 to 2.0.22 in /requirements by @dependabot in https://github.com/SEED-platform/seed/pull/4209 * Allow analysis property view related properties to be null by @perryr16 in https://github.com/SEED-platform/seed/pull/4227 * Disable ability to remove matching criteria fields once inventory is added by @perryr16 in https://github.com/SEED-platform/seed/pull/4222 +* Add documentation for cleaning up conflicting column names during migration by @nllong in https://github.com/SEED-platform/seed/pull/4264 ### Bug Fixes ๐Ÿ› * Add Open Street Map to CSP rules by @axelstudios in https://github.com/SEED-platform/seed/pull/4169 * add error handling for sf edge case by @kflemin in https://github.com/SEED-platform/seed/pull/4159 @@ -39,6 +42,8 @@ * Fix Meter Overwrites by @axelstudios in https://github.com/SEED-platform/seed/pull/4250 * Fix filter group dropdown bugs by @ebeers-png in https://github.com/SEED-platform/seed/pull/4249 * Fix EEEJ analysis errors when there are no lat/long or address by @kflemin in https://github.com/SEED-platform/seed/pull/4247 +* ArcGIS CSP rule by @axelstudios in https://github.com/SEED-platform/seed/pull/4265 +* Fix edge case for map label filtering by @axelstudios in https://github.com/SEED-platform/seed/pull/4270 **Full Changelog**: https://github.com/SEED-platform/seed/compare/v2.19.0...v2.20.0 diff --git a/docker/nginx/seed-csp.conf b/docker/nginx/seed-csp.conf index 4f530ac469..56b67213ae 100644 --- a/docker/nginx/seed-csp.conf +++ b/docker/nginx/seed-csp.conf @@ -4,6 +4,8 @@ # https://www.html5rocks.com/en/tutorials/security/content-security-policy/#inline-code-considered-harmful set $DEFAULT "default-src 'self'"; +set $CONNECT "connect-src 'self' https://services.arcgis.com/"; + set $SCRIPT "script-src 'self' 'unsafe-inline' 'unsafe-eval'"; set $SCRIPT "${SCRIPT} https://better-lbnl-development.herokuapp.com"; set $SCRIPT "${SCRIPT} https://better.lbl.gov"; @@ -42,4 +44,4 @@ set $IMG "${IMG} https://validator.swagger.io"; set $OBJECT "object-src 'none'"; -set $CSP "${DEFAULT}; ${SCRIPT}; ${STYLE}; ${FONT}; ${FRAME}; ${IMG}; ${OBJECT}"; +set $CSP "${DEFAULT}; ${CONNECT}; ${SCRIPT}; ${STYLE}; ${FONT}; ${FRAME}; ${IMG}; ${OBJECT}"; diff --git a/docs/source/migrations.rst b/docs/source/migrations.rst index 350fe4ab18..9a7d9bd7c6 100644 --- a/docs/source/migrations.rst +++ b/docs/source/migrations.rst @@ -54,7 +54,19 @@ Version 2.20.0 Version 2.19.0 -------------- -- There are no special migrations needed for this version. Simply run `./manage.py migrate`. +- Run `./manage.py migrate`. +- There is a new migration in this release that requires column names to be unique across `organization`, `table_name`, and `is_extra_data`. This migration will fail if there are duplicate column names. If you have duplicate column names, you will need to manually fix them in your database before running the migration. The following steps will help you identify and fix the duplicate column names: + - Check the organization age to gauge the impact of the change. If it is a deprecated org, impact of the change will be low. Often this issue arose in older organizations when units were not part of the columns. The old mapping columns were not upserts with the units, so typically the columns impacted are the ones with units. + - Query the `seed_column` table for the organization and column name displayed on the screen (e.g., `organization_id = 300 and column_name = 'Source EUI (kBtu/ft2)'`). If there is no `table_name` set, it is likely an import file column name and can easily be cleaned up without causing issues. In such cases, there will be two rows, and you want to keep the one with the `units_pint` column set. + - More complex columns may require deleting or updating the `column_id` in the `seed_columnmapping_*` tables. If there is a foreign key constraint with `seed_columnmapping_*`, take note of the ID you want to remove and the ID you want it to be replaced with (preferably keep the one with units_pint). + - If the constraint is on `seed_columnmapping_column_raw`: + - The field should be an import file column (i.e., no `table_name` item). Query for the old column in `seed_columnmapping_column_raw` (e.g., `column_name = `). + - Replace the old ID with the new one. If it errors because it already exists, then the row can be deleted. + - Return to the `seed_column` table and remove the old ID. + - If the constraint is on `seed_columnmapping_column_mapped`: + - The mapped column should have a `table_name` in the field. If not, it is likely an older organization. + - If there is no `table_name`, remove the row from the `seed_columnmapping_column_mapped` table. + - Return to the `seed_column` table and remove the old ID. Version 2.18.1 -------------- diff --git a/seed/static/seed/js/controllers/inventory_map_controller.js b/seed/static/seed/js/controllers/inventory_map_controller.js index e68dce3283..3df4459830 100644 --- a/seed/static/seed/js/controllers/inventory_map_controller.js +++ b/seed/static/seed/js/controllers/inventory_map_controller.js @@ -556,21 +556,22 @@ angular.module('BE.seed.controller.inventory_map', []) return rerenderPoints(records); } + const viewIdProperty = isPropertiesTab ? 'property_view_id' : 'taxlot_view_id'; if ($scope.labelLogic === 'and') { // Find properties/taxlots with all labels - const ids = new Set($scope.selected_labels.map(({is_applied}) => is_applied).reduce((acc, ids) => acc.filter(id => ids.includes(id)))); - records = $scope.geocoded_data.filter(({id}) => ids.has(id)); + const viewIds = new Set($scope.selected_labels.map(({is_applied}) => is_applied).reduce((acc, ids) => acc.filter(id => ids.includes(id)))); + records = $scope.geocoded_data.filter((record) => viewIds.has(record[viewIdProperty])); } else if ($scope.labelLogic === 'or') { // Find properties/taxlots with any label - const ids = $scope.selected_labels.map(({is_applied}) => is_applied).reduce((acc, ids) => { + const viewIds = $scope.selected_labels.map(({is_applied}) => is_applied).reduce((acc, ids) => { for (const id of ids) acc.add(id); return acc; }, new Set()); - records = $scope.geocoded_data.filter(({id}) => ids.has(id)); + records = $scope.geocoded_data.filter((record) => viewIds.has(record[viewIdProperty])); } else if ($scope.labelLogic === 'exclude') { // Find properties/taxlots with all labels, return everything else - const ids = new Set($scope.selected_labels.map(({is_applied}) => is_applied).reduce((acc, ids) => acc.filter(id => ids.includes(id)))); - records = $scope.geocoded_data.filter(({id}) => !ids.has(id)); + const viewIds = new Set($scope.selected_labels.map(({is_applied}) => is_applied).reduce((acc, ids) => acc.filter(id => ids.includes(id)))); + records = $scope.geocoded_data.filter((record) => !viewIds.has(record[viewIdProperty])); } inventory_service.saveSelectedLabels(localStorageLabelKey, $scope.selected_labels.map(({id}) => id));