fleetmap-reports 1.0.852 → 1.0.856
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/events-report.js +4 -1
- package/src/tests/events.test.js +6 -4
package/package.json
CHANGED
package/src/events-report.js
CHANGED
|
@@ -106,6 +106,7 @@ async function processDevices (from, to, devices, data, traccar, userData) {
|
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
const alerts = deviceAlerts.filter(a => userData.allWeek || !userData.weekDays || (!a.position || isInside(a.position.fixTime, a.position.fixTime, userData)))
|
|
109
|
+
.filter(a => a.position).sort((a, b) => a.position.fixTime.localeCompare(b.position.fixTime))
|
|
109
110
|
console.log('LOADING_MESSAGE:' + d.name)
|
|
110
111
|
console.log(`PROGRESS_PERC:${++i / devices.length * 100}`)
|
|
111
112
|
|
|
@@ -248,6 +249,7 @@ function exportSpeedingReportToExcel (userData, reportData) {
|
|
|
248
249
|
{ label: translations.report.eventType, value: 'eventType' },
|
|
249
250
|
{ label: translations.report.date, value: 'fixTime' },
|
|
250
251
|
{ label: translations.report.address, value: 'address' },
|
|
252
|
+
{ label: translations.report.zone, value: 'geofenceName' },
|
|
251
253
|
{ label: translations.report.driver, value: 'driver' },
|
|
252
254
|
{ label: translations.report.info, value: 'info' },
|
|
253
255
|
{ label: 'Latitude', value: 'latitude' },
|
|
@@ -261,7 +263,8 @@ function exportSpeedingReportToExcel (userData, reportData) {
|
|
|
261
263
|
name: d.device.name,
|
|
262
264
|
eventType: getEventType(a, translations, d.device),
|
|
263
265
|
fixTime: getAlertDate(userData.user, a),
|
|
264
|
-
address: a.
|
|
266
|
+
address: a.position && a.position.address,
|
|
267
|
+
geofenceName: a.geofenceName,
|
|
265
268
|
info: getAlertInfo(userData.drivers, a, d.device, translations),
|
|
266
269
|
driver: a.driver,
|
|
267
270
|
latitude: a.position && a.position.latitude,
|
package/src/tests/events.test.js
CHANGED
|
@@ -5,12 +5,14 @@ describe('events', function () {
|
|
|
5
5
|
it('works with many devices', async () => {
|
|
6
6
|
const report = await getReports(process.env.USER_NOGARTEL, process.env.PASS_NOGARTEL)
|
|
7
7
|
const userData = await report.getUserData()
|
|
8
|
-
|
|
8
|
+
userData.devices = userData.devices.filter(d => d.name.startsWith('BBU-4428'))
|
|
9
|
+
userData.eventTypes = ['alarm_sensor']
|
|
10
|
+
console.log('devices.length', userData.devices.length)
|
|
9
11
|
const result = await report.eventsReport(
|
|
10
|
-
new Date(Date.UTC(2023,
|
|
11
|
-
new Date(Date.UTC(2023,
|
|
12
|
+
new Date(Date.UTC(2023, 8, 29, 0, 0, 0, 0)),
|
|
13
|
+
new Date(Date.UTC(2023, 8, 29, 23, 59, 59, 0)),
|
|
12
14
|
userData)
|
|
13
|
-
console.log('result', result)
|
|
15
|
+
console.log('result', result[0].devices[0].alerts)
|
|
14
16
|
}, 4000000)
|
|
15
17
|
|
|
16
18
|
// eslint-disable-next-line no-undef
|