fleetmap-reports 1.0.791 → 1.0.793

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": "1.0.791",
3
+ "version": "1.0.793",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -78,18 +78,10 @@ async function executeServerSide (allData, sliced, from, to, userData, totalDevi
78
78
  let deviceCount = 0
79
79
  for (const devices of sliced) {
80
80
  const url = `https://${process.env.SERVER_HOST}/reports/activity-report`
81
- const data = await axios.post(url, {
82
- from,
83
- to,
84
- devices,
85
- userData: { ...userData, devices },
86
- deviceCount,
87
- totalDevices,
88
- sliceSize: 20
89
- }, { withCredentials: true }).then(d => d.data)
90
-
81
+ const data = await axios.post(url, { from, to, userData: { ...userData, devices } }, { withCredentials: true }).then(d => d.data)
91
82
  allData.devices.push(...(data[0].devices))
92
- deviceCount += devices.length
83
+ deviceCount = deviceCount + devices.length
84
+ console.log(`PROGRESS_PERC:${deviceCount / totalDevices * 100}`)
93
85
  }
94
86
  }
95
87
 
@@ -104,11 +96,11 @@ async function createActivityReportByDevice (from, to, userData, traccarInstance
104
96
  }
105
97
 
106
98
  if (isClientSide() && allDevices.length > 200) {
107
- const sliced = automaticReports.sliceArray(allDevices, 20)
99
+ const sliced = automaticReports.sliceArray(allDevices, 50)
108
100
  await executeServerSide(allData, sliced, from, to, userData, allDevices.length)
109
101
  } else {
110
102
  let deviceCount = 0
111
- const sliced = automaticReports.sliceArray(allDevices, 10)
103
+ const sliced = automaticReports.sliceArray(allDevices, 20)
112
104
  for (const devices of sliced) {
113
105
  let summaries = []
114
106
  const needRoute = userData.groupByDay || !userData.allWeek
@@ -116,7 +108,7 @@ async function createActivityReportByDevice (from, to, userData, traccarInstance
116
108
  trips,
117
109
  route,
118
110
  summary
119
- } = await traccar.getAllInOne(traccarInstance, from, to, devices, needRoute, true, false, !userData.groupByDay, deviceCount, allDevices.length)
111
+ } = await traccar.getAllInOne(traccarInstance, from, to, devices, needRoute, true, false, !userData.groupByDay, deviceCount, allDevices.length, 10)
120
112
 
121
113
  if (userData.groupByDay) {
122
114
  console.log('trips:' + trips.length)