log 3
This commit is contained in:
@ -473,6 +473,7 @@ class ListenController {
|
|||||||
|
|
||||||
// -- Commit each record to DB --
|
// -- Commit each record to DB --
|
||||||
let previousCrtD = 0
|
let previousCrtD = 0
|
||||||
|
let countInserted = 0
|
||||||
for (const rec of records) {
|
for (const rec of records) {
|
||||||
// console.log("rec ====> ", rec)
|
// console.log("rec ====> ", rec)
|
||||||
const timestamp_device = Math.floor(rec.gnss.timestamp / 1000) - 25200
|
const timestamp_device = Math.floor(rec.gnss.timestamp / 1000) - 25200
|
||||||
@ -532,14 +533,16 @@ class ListenController {
|
|||||||
: rec.io["Fuel Consumed (counted)"] ?? 0,
|
: rec.io["Fuel Consumed (counted)"] ?? 0,
|
||||||
}
|
}
|
||||||
|
|
||||||
await commitMessage(now, logDevice)
|
await commitMessage(now, logDevice).then(() => {
|
||||||
|
countInserted++
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// IO: {"Ignition":0,"Movement":1,"GSM Signal":5,"Sleep Mode":0,"GNSS Status":1,"Accelerator Pedal Position":0,"External Voltage":13087,"Battery Voltage":4100,"Fuel Level":144,"Engine RPM":0,"Engine Temperature":950,"Trip Odometer":48250,"Total Odometer":288320,"Total Mileage":125662000,"Fuel Consumed (counted)":229}
|
// IO: {"Ignition":0,"Movement":1,"GSM Signal":5,"Sleep Mode":0,"GNSS Status":1,"Accelerator Pedal Position":0,"External Voltage":13087,"Battery Voltage":4100,"Fuel Level":144,"Engine RPM":0,"Engine Temperature":950,"Trip Odometer":48250,"Total Odometer":288320,"Total Mileage":125662000,"Fuel Consumed (counted)":229}
|
||||||
|
|
||||||
apiRes = JSON.parse(JSON.stringify(response[200]))
|
apiRes = JSON.parse(JSON.stringify(response[200]))
|
||||||
apiRes.meta.message = "success"
|
apiRes.meta.message = "success"
|
||||||
// apiRes.data = "logDevice"
|
apiRes.data = { device_imei: imei, records_received: records.length, records_inserted: countInserted }
|
||||||
return res.status(200).json(apiRes)
|
return res.status(200).json(apiRes)
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error("❌ error:", err.message)
|
console.error("❌ error:", err.message)
|
||||||
|
|||||||
Reference in New Issue
Block a user