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