fleetmap-reports 1.0.649 → 1.0.650
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/zone-report.js +1 -10
package/package.json
CHANGED
package/src/zone-report.js
CHANGED
|
@@ -88,12 +88,6 @@ async function createZoneReport (from, to, userData, traccar) {
|
|
|
88
88
|
|
|
89
89
|
return reportData
|
|
90
90
|
}
|
|
91
|
-
function getPreviousOut(inDate, alerts, geofenceId, deviceRoute) {
|
|
92
|
-
return alerts
|
|
93
|
-
.filter(a => a.type === 'geofenceExit' && a.geofenceId === geofenceId)
|
|
94
|
-
.find(a => new Date(a.position.fixTime).getTime() < inDate) ||
|
|
95
|
-
new Date(deviceRoute[0].fixTime).getTime()
|
|
96
|
-
}
|
|
97
91
|
|
|
98
92
|
function getNextIn(outDate, alerts, geofenceId, deviceRoute) {
|
|
99
93
|
return alerts
|
|
@@ -125,9 +119,6 @@ async function processDevices (from, to, devices, userData, data) {
|
|
|
125
119
|
const totalInTime = moment(a.position.fixTime).diff(moment(zoneInData[a.geofenceId].position.fixTime), 'seconds')
|
|
126
120
|
const inDate = new Date(zoneInData[a.geofenceId].position.fixTime).getTime()
|
|
127
121
|
const outDate = new Date(a.position.fixTime).getTime()
|
|
128
|
-
const routeBeforeIn = deviceRoute.filter(p =>
|
|
129
|
-
new Date(p.fixTime).getTime() >= getPreviousOut(inDate, alerts, a.geofenceId, deviceRoute) &&
|
|
130
|
-
new Date(p.fixTime).getTime() < inDate)
|
|
131
122
|
const routeIn = deviceRoute.filter(p =>
|
|
132
123
|
new Date(p.fixTime).getTime() >= inDate &&
|
|
133
124
|
new Date(p.fixTime).getTime() < outDate
|
|
@@ -142,7 +133,7 @@ async function processDevices (from, to, devices, userData, data) {
|
|
|
142
133
|
outTime: a.position,
|
|
143
134
|
totalTime: totalInTime,
|
|
144
135
|
distanceIn: calculateDistance(routeIn),
|
|
145
|
-
distanceOut: calculateDistance(
|
|
136
|
+
distanceOut: calculateDistance(routeAfterOut),
|
|
146
137
|
geofenceName: geofence.name,
|
|
147
138
|
stopped: routeIn.filter(p => !p.attributes.ignition).length > 0,
|
|
148
139
|
driverName: zoneInData[a.geofenceId].position.driverName
|