fleetmap-reports 1.0.501 → 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.501",
3
+ "version": "1.0.502",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -113,42 +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
121
- }
122
- })
123
- }
124
-
125
- const simplePosition = positions.map(p => {
116
+ const lighterPositions = positions.map(p => {
126
117
  return {
127
118
  id: p.id,
128
119
  fixTime: p.fixTime,
129
120
  address: p.address,
130
121
  speed: p.speed,
131
- driverName: p.driverName,
132
122
  latitude: p.latitude,
133
123
  longitude: p.longitude,
134
124
  attributes: {
135
- temp1: p.attribute.temp1,
136
- temp2: p.attribute.temp2,
137
- door1: p.attribute.door1,
138
- door2: p.attribute.door2,
139
- sensor: p.attribute.sensor,
140
- rain: p.attribute.rain,
141
- ignition: p.attribute.ignition
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
142
133
  }
143
134
  }
144
135
  })
145
-
146
- if (positions.length > 0) {
136
+ if (lighterPositions.length > 0) {
147
137
  devicesResult.push({
148
138
  device: d,
149
139
  from,
150
140
  to,
151
- simplePosition
141
+ positions: lighterPositions
152
142
  })
153
143
  }
154
144
  }