Fix jwt-token
This commit is contained in:
@@ -394,17 +394,24 @@ const MapView = () => {
|
||||
return hasCoords;
|
||||
});
|
||||
|
||||
// Group detections by detector position to handle multiple drones at same detector
|
||||
// Group detections by detector device to handle multiple drones at same detector
|
||||
const detectionsByDetector = filteredDetections.reduce((acc, detection) => {
|
||||
const key = `${detection.geo_lat}_${detection.geo_lon}`;
|
||||
const key = detection.device_id; // Group by device_id instead of drone coordinates
|
||||
if (!acc[key]) acc[key] = [];
|
||||
acc[key].push(detection);
|
||||
return acc;
|
||||
}, {});
|
||||
|
||||
return Object.entries(detectionsByDetector).flatMap(([detectorKey, detections]) => {
|
||||
return Object.entries(detectionsByDetector).flatMap(([deviceId, detections]) => {
|
||||
// Find the detector device for these detections
|
||||
const detectorDevice = devices.find(d => d.id === parseInt(deviceId));
|
||||
if (!detectorDevice || !detectorDevice.geo_lat || !detectorDevice.geo_lon) {
|
||||
console.warn('MapView: No device found or missing coordinates for device_id:', deviceId);
|
||||
return [];
|
||||
}
|
||||
|
||||
return detections.map((detection, droneIndex) => {
|
||||
console.log('MapView: Rendering ring for detection:', detection, 'droneIndex:', droneIndex, 'totalDrones:', detections.length);
|
||||
console.log('MapView: Rendering ring for detection:', detection, 'droneIndex:', droneIndex, 'totalDrones:', detections.length, 'detector device:', detectorDevice);
|
||||
const opacity = getDetectionOpacity(detection);
|
||||
const age = getDetectionAge(detection);
|
||||
console.log('MapView: Detection age:', age, 'opacity:', opacity);
|
||||
@@ -483,9 +490,9 @@ const MapView = () => {
|
||||
const dashPattern = getDashPattern(detection.drone_type, droneIndex, totalDrones);
|
||||
const [latOffset, lonOffset] = getPositionOffset(droneIndex, totalDrones);
|
||||
|
||||
// Ensure coordinates are numbers and properly calculated
|
||||
const baseLat = parseFloat(detection.geo_lat) || 0;
|
||||
const baseLon = parseFloat(detection.geo_lon) || 0;
|
||||
// Use detector device coordinates (NOT drone coordinates)
|
||||
const baseLat = parseFloat(detectorDevice.geo_lat) || 0;
|
||||
const baseLon = parseFloat(detectorDevice.geo_lon) || 0;
|
||||
const centerLat = baseLat + latOffset;
|
||||
const centerLon = baseLon + lonOffset;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user