fleetmap-reports 2.0.335 → 2.0.336
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/sensor-report.js +4 -4
package/package.json
CHANGED
package/src/sensor-report.js
CHANGED
|
@@ -97,16 +97,16 @@ function computeSensorPeriods (positions, sensors, d, userData) {
|
|
|
97
97
|
|
|
98
98
|
const oldStartTime = current[key].startTime
|
|
99
99
|
const gap = changeTime - new Date(prevPos.fixTime)
|
|
100
|
-
if (
|
|
100
|
+
if (gap > maxDistanceBetweenPositions) {
|
|
101
101
|
const prevEndTime = new Date(prevPos.fixTime)
|
|
102
102
|
const duration = prevEndTime - oldStartTime
|
|
103
103
|
const threshold = minThreshold(true)
|
|
104
104
|
|
|
105
105
|
if (duration >= threshold) {
|
|
106
|
-
pushPeriod(key, s,
|
|
106
|
+
pushPeriod(key, s, prevValue, oldStartTime, prevEndTime, prevPos)
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
-
current[key] = { value:
|
|
109
|
+
current[key] = { value: newValue, startTime: changeTime }
|
|
110
110
|
|
|
111
111
|
continue
|
|
112
112
|
}
|
|
@@ -119,7 +119,7 @@ function computeSensorPeriods (positions, sensors, d, userData) {
|
|
|
119
119
|
let newPeriodStartTime = changeTime
|
|
120
120
|
|
|
121
121
|
// Check distance between positions
|
|
122
|
-
if (prevValue === false && newValue === true
|
|
122
|
+
if (prevValue === false && newValue === true) {
|
|
123
123
|
const nextPos = positions[i + 1]
|
|
124
124
|
if (nextPos && nextPos.attributes && nextPos.attributes[s.id] === true) {
|
|
125
125
|
const nextTime = new Date(nextPos.fixTime)
|