fix: distinguish track mileage evidence
This commit is contained in:
@@ -38,6 +38,10 @@ export function trackPlaybackInterval(speed: number) {
|
||||
return Math.max(55, 300 / Math.max(0.5, speed));
|
||||
}
|
||||
|
||||
export function trackPointMileageAvailable(point?: HistoryLocationRow) {
|
||||
return Boolean(point && (point.mileageAvailable ?? point.totalMileageKm > 0));
|
||||
}
|
||||
|
||||
export function buildTrackRailSelection(track?: TrackPlaybackResponse) {
|
||||
const pointCount = track?.points.length ?? 0;
|
||||
const stopIndexesByPoint: Array<number[] | undefined> = new Array(pointCount);
|
||||
@@ -65,7 +69,7 @@ function csvCell(value: unknown) {
|
||||
|
||||
export function trackCsv(track: TrackPlaybackResponse) {
|
||||
const headers = ['VIN', '车牌', '协议', '设备时间', '服务时间', '经度', '纬度', '速度(km/h)', '总里程(km)'];
|
||||
const rows = track.points.map((point) => [point.vin, point.plate, point.protocol, point.deviceTime, point.serverTime, point.longitude, point.latitude, point.speedKmh, point.totalMileageKm]);
|
||||
const rows = track.points.map((point) => [point.vin, point.plate, point.protocol, point.deviceTime, point.serverTime, point.longitude, point.latitude, point.speedKmh, trackPointMileageAvailable(point) ? point.totalMileageKm : '']);
|
||||
return `\uFEFF${[headers, ...rows].map((row) => row.map(csvCell).join(',')).join('\n')}`;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user