diff --git a/client/src/components/Leaflet.js b/client/src/components/Leaflet.js index 9c8f1bb1a1..5e4c23c802 100644 --- a/client/src/components/Leaflet.js +++ b/client/src/components/Leaflet.js @@ -1,4 +1,4 @@ -import { Control, CRS, DomUtil, Icon, Map, Marker, TileLayer } from "leaflet" +import { Control, CRS, Icon, Map, Marker, TileLayer } from "leaflet" import "leaflet-defaulticon-compatibility" import "leaflet-defaulticon-compatibility/dist/leaflet-defaulticon-compatibility.webpack.css" import { @@ -150,18 +150,6 @@ const Leaflet = ({ crs: CRS[Settings.imagery.mapOptions.crs] } ) - const container = DomUtil.get(mapId) - /* - * Prevent error "map container is already initialized" when mapId changed - * for the current map (which was already initialized). - * Note: this happens when the id of a map is not always the same but changes - * because of the use of _uniqueId (which we use for map aggregation widgets - * to make sure we don't have more maps with the same id on a page - like - * on the person show page for statistics of reports authored and attended) - */ - if (container !== null) { - container._leaflet_id = null - } const newMap = new Map(mapId, mapOptions).setView( Settings.imagery.mapOptions.homeView.location, Settings.imagery.mapOptions.homeView.zoomLevel diff --git a/client/src/components/ReportCollection.js b/client/src/components/ReportCollection.js index 088bd6795b..149ebb0c59 100644 --- a/client/src/components/ReportCollection.js +++ b/client/src/components/ReportCollection.js @@ -38,6 +38,7 @@ const ReportCollection = ({ const [viewFormat, setViewFormat] = useState(viewFormats[0]) const showHeader = viewFormats.length > 1 || reportsFilter const statisticsRecurrence = [RECURRENCE_TYPE.MONTHLY] + const idSuffix = mapId || paginationKey || "reports" return (
@@ -118,6 +119,7 @@ const ReportCollection = ({ {statisticsRecurrence.map(recurrence => ( - {periods.map((period, index) => ( - - {_isEmpty(periodsData[index]) ? ( - isFirstRow ? ( - No reports found - ) : null - ) : ( - - )} - - ))} + {periods.map((period, index) => { + const key = `${fieldName}-statistics-${formatPeriodBoundary( + period.start + )}` + return ( + + {_isEmpty(periodsData[index]) ? ( + isFirstRow ? ( + No reports found + ) : null + ) : ( + + )} + + ) + })} ) } FieldStatisticsRow.propTypes = { + idSuffix: PropTypes.string.isRequired, fieldConfig: PropTypes.object, fieldName: PropTypes.string, periods: PeriodsPropType.isRequired, @@ -161,6 +168,7 @@ NoStatisticsRow.propTypes = { } const ReportStatistics = ({ + idSuffix, pageDispatchers, periodsDetails, setTotalCount, @@ -248,6 +256,7 @@ const ReportStatistics = ({ Object.keys(REPORT_FIELDS_FOR_STATISTICS).map((key, index) => ( ( ( ( - {periods.map((period, index) => ( - - {_isEmpty(periodsData[index]) ? ( - isFirstRow ? ( - No assessments - ) : null - ) : ( - - )} - - ))} + {periods.map((period, index) => { + const key = `${questionKey}-assessment-${formatPeriodBoundary( + period.start + )}` + return ( + + {_isEmpty(periodsData[index]) ? ( + isFirstRow ? ( + No assessments + ) : null + ) : ( + + )} + + ) + })} ) } InstantAssessmentsRow.propTypes = { + idSuffix: PropTypes.string.isRequired, periods: PeriodsPropType.isRequired, periodsData: PropTypes.arrayOf(PropTypes.array).isRequired, questionKey: PropTypes.string.isRequired, diff --git a/client/tests/webdriver/pages/myOrg.page.js b/client/tests/webdriver/pages/myOrg.page.js index 96c6009733..ee077e0b0f 100644 --- a/client/tests/webdriver/pages/myOrg.page.js +++ b/client/tests/webdriver/pages/myOrg.page.js @@ -6,7 +6,7 @@ class MyOrg extends Page { } get locationStatistics() { - return browser.$("[id^=map-map-location-statistics]") + return browser.$("[id^=map-location-statistics]") } get engagementStatus() {