diff options
-rw-r--r-- | modern/src/reports/CombinedReportPage.js | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/modern/src/reports/CombinedReportPage.js b/modern/src/reports/CombinedReportPage.js index ecd65a24..a5000839 100644 --- a/modern/src/reports/CombinedReportPage.js +++ b/modern/src/reports/CombinedReportPage.js @@ -30,13 +30,13 @@ const CombinedReportPage = () => { const [items, setItems] = useState([]); const [loading, setLoading] = useState(false); - const createMarkers = () => items.flatMap((item) => item.events.map((event) => { - const position = item.positions.find((p) => event.positionId === p.id); - return { + const createMarkers = () => items.flatMap((item) => item.events + .map((event) => item.positions.find((p) => event.positionId === p.id)) + .filter((position) => position != null) + .map((position) => ({ latitude: position.latitude, longitude: position.longitude, - }; - })); + }))); const handleSubmit = useCatch(async ({ deviceIds, groupIds, from, to }) => { const query = new URLSearchParams({ from, to }); |