aboutsummaryrefslogtreecommitdiff
path: root/modern/src/reports
diff options
context:
space:
mode:
Diffstat (limited to 'modern/src/reports')
-rw-r--r--modern/src/reports/ChartReportPage.js19
1 files changed, 10 insertions, 9 deletions
diff --git a/modern/src/reports/ChartReportPage.js b/modern/src/reports/ChartReportPage.js
index 19ec9c12..21c069ca 100644
--- a/modern/src/reports/ChartReportPage.js
+++ b/modern/src/reports/ChartReportPage.js
@@ -4,7 +4,7 @@ import ReportFilter from './ReportFilter';
import ReportLayoutPage from './ReportLayoutPage';
import { useAttributePreference } from '../common/preferences';
import { formatDate } from '../common/formatter';
-import { getConverter } from '../common/converter';
+import { speedConverter } from '../common/converter';
import {LineChart, Line, XAxis, YAxis, CartesianGrid, Tooltip, Legend, ResponsiveContainer } from 'recharts';
const ReportFilterForm = ({ setItems }) => {
@@ -16,17 +16,18 @@ const ReportFilterForm = ({ setItems }) => {
const response = await fetch(`/api/reports/route?${query.toString()}`, { headers });
if (response.ok) {
- const data = await response.json();
+ const positions = await response.json();
- let formattedData = data.map(obj => {
- return Object.assign(
- obj,
- {speed: Number(getConverter('speed')(obj.speed, speedUnit))},
- {fixTime: formatDate(obj.fixTime)}
- );
+ let formattedPositions = positions.map(position => {
+ return {
+ speed:Number(speedConverter(position.speed, speedUnit)),
+ altitude:position.altitude,
+ accuracy:position.accuracy,
+ fixTime:formatDate(position.fixTime)
+ }
});
- setItems(formattedData);
+ setItems(formattedPositions);
}
}