fleetmap-reports 2.0.52 → 2.0.54

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.52",
3
+ "version": "2.0.54",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
package/src/kms-report.js CHANGED
@@ -44,8 +44,8 @@ async function createKmsReportByDevice (from, to, userData, traccarInstance) {
44
44
  }
45
45
 
46
46
  if (isClientSide() && (allDevices.length > 50 || ((new Date(to).getTime() - new Date(from).getTime()) > (1000 * 60 * 60 * 24 * 15))) && userData.groupByDay) {
47
- const sliced = automaticReports.sliceArray(allDevices, 1)
48
- await executeServerSide('kms-report', sliced, from, to, userData, allDevices.length, traccarInstance).then(devices => {
47
+ const sliced = automaticReports.sliceArray(allDevices, 2)
48
+ await executeServerSide('kms-report', sliced, from, to, userData, allDevices.length, traccarInstance, 1).then(devices => {
49
49
  allData.devices = devices
50
50
  })
51
51
  } else {
package/src/util/utils.js CHANGED
@@ -240,7 +240,7 @@ async function executeServerSide (type, sliced, from, to, userData, totalItems,
240
240
  await Promise.all(_sliced.map(async items => {
241
241
  const url = `https://${getServerHost()}/reports/${type}`
242
242
  try {
243
- const data = await axios.post(url, {
243
+ await axios.post(url, {
244
244
  from,
245
245
  to,
246
246
  userData: userData.byDriver
@@ -254,8 +254,9 @@ async function executeServerSide (type, sliced, from, to, userData, totalItems,
254
254
  devices: items,
255
255
  geofences: []
256
256
  }
257
- }, { withCredentials: true }).then(d => d.data)
258
- reportData.push(...(userData.byDriver ? data[0].drivers : data[0].devices))
257
+ }, { withCredentials: true }).then(d => {
258
+ reportData.push(...(userData.byDriver ? d.data[0].drivers : d.data[0].devices))
259
+ })
259
260
  itemsCount = itemsCount + items.length
260
261
  } catch (e) {
261
262
  console.error(e)