diff options
author | Anton Tananaev <anton@traccar.org> | 2023-06-14 05:38:04 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2023-06-14 05:38:04 -0700 |
commit | 0810d3fc2a2fc17131cffb442e7f050467275693 (patch) | |
tree | 1709894552a9308a81d9e7c5c57d28ae3606c243 /modern/src/reports/CombinedReportPage.js | |
parent | 299b69887b2f2fcedc71b6a000effeab5ba58b25 (diff) | |
download | trackermap-web-0810d3fc2a2fc17131cffb442e7f050467275693.tar.gz trackermap-web-0810d3fc2a2fc17131cffb442e7f050467275693.tar.bz2 trackermap-web-0810d3fc2a2fc17131cffb442e7f050467275693.zip |
Handle missing positions
Diffstat (limited to 'modern/src/reports/CombinedReportPage.js')
-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 }); |