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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fleetmap-reports",
3
- "version": "2.0.335",
3
+ "version": "2.0.336",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -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 (prevValue === true && newValue === true && gap > maxDistanceBetweenPositions) {
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, true, oldStartTime, prevEndTime, prevPos)
106
+ pushPeriod(key, s, prevValue, oldStartTime, prevEndTime, prevPos)
107
107
  }
108
108
 
109
- current[key] = { value: true, startTime: changeTime }
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 && maxDistanceBetweenPositions > 0) {
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)