fleetmap-reports 1.0.500 → 1.0.502

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.500",
3
+ "version": "1.0.502",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -113,21 +113,32 @@ function processDevices (from, to, devices, data, userData) {
113
113
  for (const d of devices) {
114
114
  const positions = data.route.filter(t => t.deviceId === d.id)
115
115
 
116
- if (userData.drivers.length > 0) {
117
- positions.forEach(p => {
118
- const driver = userData.drivers.find(d => d.uniqueId === p.attributes.driverUniqueId)
119
- if (driver) {
120
- p.driverName = driver.name
116
+ const lighterPositions = positions.map(p => {
117
+ return {
118
+ id: p.id,
119
+ fixTime: p.fixTime,
120
+ address: p.address,
121
+ speed: p.speed,
122
+ latitude: p.latitude,
123
+ longitude: p.longitude,
124
+ attributes: {
125
+ driverUniqueId: p.attributes.driverUniqueId,
126
+ temp1: p.attributes.temp1,
127
+ temp2: p.attributes.temp2,
128
+ door1: p.attributes.door1,
129
+ door2: p.attributes.door2,
130
+ sensor: p.attributes.sensor,
131
+ rain: p.attributes.rain,
132
+ ignition: p.attributes.ignition
121
133
  }
122
- })
123
- }
124
-
125
- if (positions.length > 0) {
134
+ }
135
+ })
136
+ if (lighterPositions.length > 0) {
126
137
  devicesResult.push({
127
138
  device: d,
128
139
  from,
129
140
  to,
130
- positions
141
+ positions: lighterPositions
131
142
  })
132
143
  }
133
144
  }
@@ -91,6 +91,7 @@ async function getAllInOne (
91
91
  const requests = []
92
92
  for (const _chunk of automaticReports.sliceArray(chunk, devicesPerRequest)) {
93
93
  const u = url + '&' + _chunk.map(d => `deviceId=${d.id}`).join('&')
94
+ console.log(u)
94
95
  requests.push(
95
96
  traccar.axios.get(u, {
96
97
  jar: traccar.cookieJar,