fleetmap-reports 2.0.89 → 2.0.92
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/speeding-report.js +2 -1
- package/src/util/utils.js +3 -2
package/package.json
CHANGED
package/src/speeding-report.js
CHANGED
|
@@ -126,8 +126,9 @@ async function createSpeedingReportByDriver (from, to, userData, traccarInstance
|
|
|
126
126
|
|
|
127
127
|
async function getEvents (traccarInstance, from, to, devices, userData, deviceCount, totalDevices, sliceSize) {
|
|
128
128
|
if (processServerSide()) {
|
|
129
|
+
const cookie = await axios.get('/pinmeapi/cookie/get', { withCredentials: true }).then(d => d.data)
|
|
129
130
|
const url = `https://${getServerHost()}/pinmeapi/reports/speeding-report/getEvents`
|
|
130
|
-
return axios.post(url, { from, to, devices, userData, deviceCount, totalDevices, sliceSize }, { withCredentials: true }).then(d => d.data)
|
|
131
|
+
return axios.post(url, { from, to, devices, userData, deviceCount, totalDevices, sliceSize, cookie }, { withCredentials: true }).then(d => d.data)
|
|
131
132
|
} else {
|
|
132
133
|
const geofencesFeatures = userData.geofences.filter(g => g.area.startsWith('POLYGON') &&
|
|
133
134
|
g.attributes.speedLimit).map(g => convertToFeature(g))
|
package/src/util/utils.js
CHANGED
|
@@ -3,6 +3,7 @@ const {
|
|
|
3
3
|
getUserPartner
|
|
4
4
|
} = require('fleetmap-partners')
|
|
5
5
|
const messages = require('../../lang')
|
|
6
|
+
const axios = require('axios').default
|
|
6
7
|
const distance = require('@turf/distance')
|
|
7
8
|
const { devicesToProcess } = require('./device')
|
|
8
9
|
|
|
@@ -230,10 +231,10 @@ function weekDaySelected (date, weekDays) {
|
|
|
230
231
|
(date.getDay() === 6 && weekDays.saturday))
|
|
231
232
|
}
|
|
232
233
|
|
|
233
|
-
async function executeServerSide (type, sliced, from, to, userData, totalItems,
|
|
234
|
+
async function executeServerSide (type, sliced, from, to, userData, totalItems, traccar, maxRequests = 10) {
|
|
234
235
|
let itemsCount = 0
|
|
235
236
|
console.log('PROGRESS_PERC:1')
|
|
236
|
-
const cookie = await axios.get(
|
|
237
|
+
const cookie = await axios.get('/pinmeapi/cookie/get', { withCredentials: true }).then(d => d.data)
|
|
237
238
|
const reportData = []
|
|
238
239
|
for (let i = 0; i < sliced.length; i += maxRequests) {
|
|
239
240
|
const _sliced = sliced.slice(i, i + maxRequests)
|