fleetmap-reports 2.0.94 → 2.0.95

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.94",
3
+ "version": "2.0.95",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -70,6 +70,6 @@ describe('Kms_Reports', function () {
70
70
  const data = await reports.kmsReport(convertFromLocal(new Date(2024, 2, 18, 0, 0, 0), userData.user.attributes.timezone), convertFromLocal(new Date(2024, 2, 18, 23, 59, 59), userData.user.attributes.timezone),
71
71
  userData)
72
72
  const device = data[0].devices.find(d => d.device.id === 93497)
73
- assert.equal(device, 1)
73
+ assert.equal(device.days.length, 1)
74
74
  }, 3000000)
75
75
  })
@@ -58,12 +58,12 @@ async function getSummary (traccar, from, to, devices) {
58
58
  const arrayOfArrays = automaticReports.sliceArray(devicesToSlice, 50)
59
59
  let requests = []
60
60
  for (const a of arrayOfArrays) {
61
- const promise = traccar.reports.reportsSummaryGet(from, to, a.map(d => d.id))
61
+ const promise = getAllInOne(traccar, from, to, a, false, false, false, true, 0, a.length, a.length, a.length, undefined, true)
62
62
  requests = requests.concat(promise)
63
63
  }
64
64
 
65
65
  const result = await Promise.all(requests)
66
- return result.map(r => r.data).flat()
66
+ return result.map(r => r.summary).flat()
67
67
  }
68
68
 
69
69
  async function getAllInOne (
@@ -148,9 +148,7 @@ async function getSummaryByDay (dates, userData, traccarInstance, allDevices, ig
148
148
  const startDate = isClientSide() ? startDateLocal : convertFromLocal(startDateLocal, userData.user.attributes.timezone)
149
149
  const endDate = isClientSide() ? endDateLocal : convertFromLocal(endDateLocal, userData.user.attributes.timezone)
150
150
 
151
- const {
152
- summary
153
- } = await getAllInOne(traccarInstance, startDate, endDate, allDevices, false, false, false, true, 0, allDevices.length, allDevices.length, allDevices.length, undefined, true)
151
+ const summary = await getSummary(traccarInstance, startDate, endDate, allDevices)
154
152
 
155
153
  counter = counter + 1
156
154
  if (!ignorePercentage) {