fleetmap-reports 1.0.810 → 1.0.812

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fleetmap-reports",
3
- "version": "1.0.810",
3
+ "version": "1.0.812",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -77,8 +77,9 @@ async function processDevices (from, to, devices, data, traccar, userData) {
77
77
  for (let j = 0; j < devices.length; j += maxParallelRequests) {
78
78
  await Promise.all(devices.slice(j, j + maxParallelRequests).map(async d => {
79
79
  const deviceAlerts = data.filter(t => t.deviceId === d.id)
80
-
81
- const response = await traccar.reports.reportsRouteGet(from, to, [d.id])
80
+ // events can arrive at bd very late, so we search with a 24 hours delay
81
+ const dayBefore = new Date(new Date(from).setDate(from.getDate() - 1))
82
+ const response = await traccar.reports.reportsRouteGet(dayBefore, to, [d.id])
82
83
  const positions = response.data
83
84
 
84
85
  for (const a of deviceAlerts) {