fleetmap-reports 1.0.762 → 1.0.763

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/zone-report.js +10 -8
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fleetmap-reports",
3
- "version": "1.0.762",
3
+ "version": "1.0.763",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -131,7 +131,7 @@ async function processDevices (from, to, devices, userData, data) {
131
131
  geofencesData.push({
132
132
  geofenceId: geofence.id,
133
133
  geofenceName: geofence.name,
134
- days: dataByDay
134
+ days: userData.onlyWithKmsOut ? dataByDay.filter(d => d.distanceOut) : dataByDay
135
135
  })
136
136
  }
137
137
 
@@ -154,12 +154,14 @@ async function processDevices (from, to, devices, userData, data) {
154
154
  }
155
155
  })
156
156
 
157
- if (distanceOut || geofences.filter(g => g.distanceIn).length) {
158
- groupByDay.push({
159
- date,
160
- geofences,
161
- distanceOut
162
- })
157
+ if (distanceOut > 0.01 || geofences.filter(g => g.distanceIn > 0.01).length) {
158
+ if (!userData.onlyWithKmsOut || distanceOut) {
159
+ groupByDay.push({
160
+ date,
161
+ geofences,
162
+ distanceOut
163
+ })
164
+ }
163
165
  }
164
166
  }
165
167
 
@@ -187,7 +189,7 @@ async function processDevices (from, to, devices, userData, data) {
187
189
  device: d,
188
190
  from,
189
191
  to,
190
- geofences: zoneInOutData
192
+ geofences: userData.onlyWithKmsOut ? zoneInOutData.filter(a => a.distanceOut) : zoneInOutData
191
193
  })
192
194
  }
193
195
  }