fleetmap-reports 1.0.925 → 1.0.929
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/kms-report.js +1 -1
- package/src/util/utils.js +17 -13
- package/src/zone-report.js +1 -1
package/package.json
CHANGED
package/src/kms-report.js
CHANGED
|
@@ -44,7 +44,7 @@ async function createKmsReportByDevice (from, to, userData, traccarInstance) {
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
if (isClientSide() && allDevices.length > 50 && userData.groupByDay) {
|
|
47
|
-
const sliced = automaticReports.sliceArray(allDevices,
|
|
47
|
+
const sliced = automaticReports.sliceArray(allDevices, 1)
|
|
48
48
|
await executeServerSide('kms-report', allData, sliced, from, to, userData, allDevices.length)
|
|
49
49
|
} else {
|
|
50
50
|
let deviceCount = 0
|
package/src/util/utils.js
CHANGED
|
@@ -227,21 +227,25 @@ function weekDaySelected (date, weekDays) {
|
|
|
227
227
|
async function executeServerSide (type, allData, sliced, from, to, userData, totalDevices) {
|
|
228
228
|
let deviceCount = 0
|
|
229
229
|
console.log('PROGRESS_PERC:1')
|
|
230
|
-
const maxRequests =
|
|
231
|
-
for (let i=0; i < sliced.length; i+=maxRequests) {
|
|
232
|
-
const _sliced = sliced.slice(i, i+maxRequests)
|
|
230
|
+
const maxRequests = 10
|
|
231
|
+
for (let i = 0; i < sliced.length; i += maxRequests) {
|
|
232
|
+
const _sliced = sliced.slice(i, i + maxRequests)
|
|
233
233
|
await Promise.all(_sliced.map(async devices => {
|
|
234
234
|
const url = `https://${process.env.SERVER_HOST}/reports/${type}`
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
235
|
+
try {
|
|
236
|
+
const data = await axios.post(url, {
|
|
237
|
+
from,
|
|
238
|
+
to,
|
|
239
|
+
userData: {
|
|
240
|
+
...userData,
|
|
241
|
+
devices
|
|
242
|
+
}
|
|
243
|
+
}, { withCredentials: true }).then(d => d.data)
|
|
244
|
+
allData.devices.push(...(data[0].devices))
|
|
245
|
+
deviceCount = deviceCount + devices.length
|
|
246
|
+
} catch (e) {
|
|
247
|
+
console.error(e)
|
|
248
|
+
}
|
|
245
249
|
console.log(`PROGRESS_PERC:${deviceCount / totalDevices * 100}`)
|
|
246
250
|
}))
|
|
247
251
|
}
|
package/src/zone-report.js
CHANGED
|
@@ -262,7 +262,7 @@ function getAnyNextIn (outDate, alerts, deviceRoute) {
|
|
|
262
262
|
.filter(a => a.type === 'geofenceEnter')
|
|
263
263
|
.find(a => new Date(a.position.fixTime).getTime() > outDate)
|
|
264
264
|
|
|
265
|
-
if (!alerts.filter(a => a.type === 'geofenceExit' &&
|
|
265
|
+
if (next && !alerts.filter(a => a.type === 'geofenceExit' &&
|
|
266
266
|
new Date(a.position.fixTime).getTime() > outDate &&
|
|
267
267
|
new Date(a.position.fixTime).getTime() < new Date(next.position.fixTime).getTime()).length) {
|
|
268
268
|
return (next && next.position && new Date(next.position.fixTime).getTime()) ||
|