fleetmap-reports 2.0.32 → 2.0.33

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.32",
3
+ "version": "2.0.33",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
package/src/kms-report.js CHANGED
@@ -104,15 +104,15 @@ async function createKmsReportByDevice (from, to, userData, traccarInstance) {
104
104
  async function createKmsReportByDriver (from, to, userData, traccarInstance) {
105
105
  const report = { drivers: [] }
106
106
 
107
- const { devices, drivers } = await driversUtil.devicesByDriver(traccarInstance, from, to, userData.drivers, userData.devices)
108
-
109
- console.log(drivers.length, devices.length)
110
-
111
- userData.devices = devices
112
- userData.drivers = drivers
107
+ if (!userData.requestToRunServerSide) {
108
+ const { devices, drivers } = await driversUtil.devicesByDriver(traccarInstance, from, to, userData.drivers, userData.devices)
109
+ userData.devices = devices
110
+ userData.drivers = drivers
111
+ }
113
112
 
114
113
  if (isClientSide() && (userData.drivers.length > 50 || ((new Date(to).getTime() - new Date(from).getTime()) > (1000 * 60 * 60 * 24 * 15))) && userData.groupByDay) {
115
114
  const sliced = automaticReports.sliceArray(userData.drivers, 10)
115
+ userData.requestToRunServerSide = true
116
116
  await executeServerSide('kms-report', sliced, from, to, userData, userData.drivers.length, traccarInstance, 5).then(drivers => {
117
117
  report.drivers = drivers
118
118
  })