fleetmap-reports 1.0.716 → 1.0.717
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 +1 -1
- package/src/activity-report.js +20 -5
package/package.json
CHANGED
package/src/activity-report.js
CHANGED
|
@@ -191,7 +191,9 @@ function processDevices (from, to, devices, data, userData) {
|
|
|
191
191
|
endOdometer: 0,
|
|
192
192
|
startOdometer: 0,
|
|
193
193
|
startTime: tripsByDay.length && tripsByDay[0].startTime,
|
|
194
|
-
|
|
194
|
+
startAddress: tripsByDay.length && tripsByDay[0].startAddress,
|
|
195
|
+
endTime: tripsByDay.length && tripsByDay[tripsByDay.length - 1].endTime,
|
|
196
|
+
endAddress: tripsByDay.length && tripsByDay[tripsByDay.length - 1].endAddress
|
|
195
197
|
})
|
|
196
198
|
}
|
|
197
199
|
} else {
|
|
@@ -204,7 +206,9 @@ function processDevices (from, to, devices, data, userData) {
|
|
|
204
206
|
summaryCurrentDay.distance = distance
|
|
205
207
|
summaryCurrentDay.convertedSpentFuel = automaticReports.calculateSpentFuel(summaryCurrentDay.spentFuel, d)
|
|
206
208
|
summaryCurrentDay.startTime = tripsByDay.length && tripsByDay[0].startTime
|
|
209
|
+
summaryCurrentDay.startAddress = tripsByDay.length && tripsByDay[0].startAddress
|
|
207
210
|
summaryCurrentDay.endTime = tripsByDay.length && tripsByDay[tripsByDay.length - 1].endTime
|
|
211
|
+
summaryCurrentDay.endAddress = tripsByDay.length && tripsByDay[tripsByDay.length - 1].endAddress
|
|
208
212
|
|
|
209
213
|
summary.push(summaryCurrentDay)
|
|
210
214
|
}
|
|
@@ -225,7 +229,9 @@ function processDevices (from, to, devices, data, userData) {
|
|
|
225
229
|
startOdometer: trips.length ? trips[0].startOdometer : 0,
|
|
226
230
|
endOdometer: trips.length ? trips[trips.length - 1].endOdometer : 0,
|
|
227
231
|
startTime: trips.length && trips[0].startTime,
|
|
228
|
-
|
|
232
|
+
startAddress: trips.length && trips[0].startAddress,
|
|
233
|
+
endTime: trips.length && trips[trips.length - 1].endTime,
|
|
234
|
+
endAddress: trips.length && trips[trips.length - 1].endAddress
|
|
229
235
|
})
|
|
230
236
|
} else {
|
|
231
237
|
summary.push(...data.summaries.filter(s => s.deviceId === d.id))
|
|
@@ -236,7 +242,9 @@ function processDevices (from, to, devices, data, userData) {
|
|
|
236
242
|
s.distance = deviceTrips.reduce((a, b) => a + b.distance, 0)
|
|
237
243
|
s.convertedSpentFuel = automaticReports.calculateSpentFuel(s.spentFuel, d)
|
|
238
244
|
s.startTime = deviceTrips.length && deviceTrips[0].startTime
|
|
245
|
+
s.startAddress = deviceTrips.length && deviceTrips[0].startAddress
|
|
239
246
|
s.endTime = deviceTrips.length && deviceTrips[deviceTrips.length - 1].endTime
|
|
247
|
+
s.endAddress = deviceTrips.length && deviceTrips[deviceTrips.length - 1].endAddress
|
|
240
248
|
})
|
|
241
249
|
}
|
|
242
250
|
}
|
|
@@ -246,7 +254,10 @@ function processDevices (from, to, devices, data, userData) {
|
|
|
246
254
|
device: d,
|
|
247
255
|
summary
|
|
248
256
|
}
|
|
249
|
-
|
|
257
|
+
|
|
258
|
+
if ((deviceData.summary.length && deviceData.summary[0].startTime) || !userData.onlyWithActivity) {
|
|
259
|
+
devicesResult.push(deviceData)
|
|
260
|
+
}
|
|
250
261
|
})
|
|
251
262
|
|
|
252
263
|
return devicesResult
|
|
@@ -279,7 +290,9 @@ function processDrivers (from, to, drivers, data, userData) {
|
|
|
279
290
|
maxSpeed: tripsByDay.reduce((a, b) => Math.max(a, b.maxSpeed), 0),
|
|
280
291
|
averageSpeed: tripsByDay.length ? Math.round(tripsByDay.reduce((a, b) => a + b.averageSpeed, 0) / tripsByDay.length) : 0,
|
|
281
292
|
startTime: tripsByDay.length && tripsByDay[0].startTime,
|
|
282
|
-
|
|
293
|
+
startAddress: tripsByDay.length && tripsByDay[0].startAddress,
|
|
294
|
+
endTime: tripsByDay.length && tripsByDay[tripsByDay.length - 1].endTime,
|
|
295
|
+
endAddress: tripsByDay.length && tripsByDay[tripsByDay.length - 1].endAddress
|
|
283
296
|
})
|
|
284
297
|
}
|
|
285
298
|
} else {
|
|
@@ -289,7 +302,9 @@ function processDrivers (from, to, drivers, data, userData) {
|
|
|
289
302
|
maxSpeed: trips.reduce((a, b) => Math.max(a, b.maxSpeed), 0),
|
|
290
303
|
averageSpeed: Math.round(trips.reduce((a, b) => a + b.averageSpeed, 0) / trips.length),
|
|
291
304
|
startTime: trips.length && trips[0].startTime,
|
|
292
|
-
|
|
305
|
+
startAddress: trips.length && trips[0].startAddress,
|
|
306
|
+
endTime: trips.length && trips[trips.length - 1].endTime,
|
|
307
|
+
endAddress: trips.length && trips[trips.length - 1].endAddress
|
|
293
308
|
})
|
|
294
309
|
}
|
|
295
310
|
driversResult.push(driverData)
|