fix speeds
This commit is contained in:
parent
4ef2fe7735
commit
831ea1d991
37
server.js
37
server.js
@ -398,16 +398,22 @@ pool.query(subquery, selectedDevices, (err, result) => {
|
|||||||
|
|
||||||
const minuteInMillis = 60000;
|
const minuteInMillis = 60000;
|
||||||
|
|
||||||
const devicesData = result.rows.map((row) => ({
|
const devicesData = result.rows.map((row) => {
|
||||||
serial: row.serial,
|
if (row.speed > 150) {
|
||||||
longitude: row.longitude,
|
row.speed /= 100;
|
||||||
latitude: row.latitude,
|
}
|
||||||
direction: row.direction,
|
|
||||||
speed: row.speed,
|
return {
|
||||||
status: Date.now() - Date.parse(row.lastkeepalive) <= minuteInMillis,
|
serial: row.serial,
|
||||||
plate: row.plate,
|
longitude: row.longitude,
|
||||||
group: row.group,
|
latitude: row.latitude,
|
||||||
}));
|
direction: row.direction,
|
||||||
|
speed: row.speed,
|
||||||
|
status: Date.now() - Date.parse(row.lastkeepalive) <= minuteInMillis,
|
||||||
|
plate: row.plate,
|
||||||
|
group: row.group,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
console.log(devicesData)
|
console.log(devicesData)
|
||||||
|
|
||||||
@ -893,7 +899,7 @@ app.get('/reports/:id', async (req, res) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
templateData.Type = type;
|
templateData.Type = type;
|
||||||
templateData.Speed = alarm.speed;
|
templateData.Speed = actualSpeed;
|
||||||
templateData.Date = formatDate(alarm.time);
|
templateData.Date = formatDate(alarm.time);
|
||||||
templateData.Serial = alarm.serial;
|
templateData.Serial = alarm.serial;
|
||||||
templateData.Geo = alarm.latitude + "," + alarm.longitude;
|
templateData.Geo = alarm.latitude + "," + alarm.longitude;
|
||||||
@ -910,7 +916,14 @@ app.get('/reports/:id', async (req, res) => {
|
|||||||
templateData.NextLatitude = alarm.next_latitude;
|
templateData.NextLatitude = alarm.next_latitude;
|
||||||
templateData.NextLongitude = alarm.next_longitude;
|
templateData.NextLongitude = alarm.next_longitude;
|
||||||
|
|
||||||
templateData.Speeds = alarm.nearest_speeds;
|
templateData.Speeds = alarm.nearest_speeds
|
||||||
|
templateData.Speeds = templateData.Speeds.map(speed => {
|
||||||
|
if (speed > 150) {
|
||||||
|
return speed / 100;
|
||||||
|
} else {
|
||||||
|
return speed;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
console.log(templateData);
|
console.log(templateData);
|
||||||
|
|
||||||
|
@ -178,8 +178,8 @@
|
|||||||
<video id="camera-5"></video>
|
<video id="camera-5"></video>
|
||||||
<!-- <video id="camera-6"></video>
|
<!-- <video id="camera-6"></video>
|
||||||
<video id="camera-7"></video>
|
<video id="camera-7"></video>
|
||||||
<video id="camera-8"></video>
|
<video id="camera-8"></video> -->
|
||||||
<video id="camera-9"></video>
|
<!-- <video id="camera-9"></video>
|
||||||
<video id="camera-10"></video>
|
<video id="camera-10"></video>
|
||||||
<video id="camera-11"></video>
|
<video id="camera-11"></video>
|
||||||
<video id="camera-12"></video>
|
<video id="camera-12"></video>
|
||||||
|
Loading…
Reference in New Issue
Block a user