fleetmap-reports 1.0.793 → 1.0.794

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.793",
3
+ "version": "1.0.794",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -10,7 +10,6 @@ const { getStyle } = require('./reportStyle')
10
10
  const { getUserPartner } = require('fleetmap-partners')
11
11
  const traccar = require('./util/traccar')
12
12
  const { isInsideTimetable, isPartialInsideTimetable, calculateTrip } = require('./util/trips')
13
- const tripHelper = require('./util/trips')
14
13
  const { devicesToProcess } = require('./util/device')
15
14
  const { getDriverData } = require('./util/driver')
16
15
  const { calculateConsumption } = require('./util/fuel')
@@ -102,7 +101,6 @@ async function createActivityReportByDevice (from, to, userData, traccarInstance
102
101
  let deviceCount = 0
103
102
  const sliced = automaticReports.sliceArray(allDevices, 20)
104
103
  for (const devices of sliced) {
105
- let summaries = []
106
104
  const needRoute = userData.groupByDay || !userData.allWeek
107
105
  const {
108
106
  trips,
@@ -110,35 +108,9 @@ async function createActivityReportByDevice (from, to, userData, traccarInstance
110
108
  summary
111
109
  } = await traccar.getAllInOne(traccarInstance, from, to, devices, needRoute, true, false, !userData.groupByDay, deviceCount, allDevices.length, 10)
112
110
 
113
- if (userData.groupByDay) {
114
- console.log('trips:' + trips.length)
115
-
116
- if (trips.length) {
117
- tripHelper.checkTripsKms(traccarInstance, from, to, devices, { trips, route })
118
- }
119
-
120
- const dates = getDates(from, to)
121
- for (const date of dates) {
122
- if (userData.allWeek || !userData.weekDays || !userData.dayHours) {
123
- const fromByDay = new Date(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0)
124
- const toByDay = new Date(date.getFullYear(), date.getMonth(), date.getDate(), 23, 59, 59)
125
-
126
- const summary = await traccar.getSummary(traccarInstance, fromByDay, toByDay, devices)
127
- summary.forEach(s => {
128
- s.date = date
129
- })
130
- summaries = summaries.concat(summary)
131
- }
132
- }
133
- } else {
134
- summaries = summary
135
- }
136
-
137
- console.log('Summary:' + summaries.length)
138
-
139
111
  // Process report data
140
- if (summaries.length || trips.length) {
141
- allData.devices = allData.devices.concat(processDevices(from, to, devices, { summaries, trips, route }, userData))
112
+ if (summary.length || trips.length) {
113
+ allData.devices = allData.devices.concat(processDevices(from, to, devices, { summary, trips, route }, userData))
142
114
  }
143
115
  deviceCount += devices.length
144
116
  }