fleetmap-reports 1.0.919 → 1.0.920

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.919",
3
+ "version": "1.0.920",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
package/src/kms-report.js CHANGED
@@ -166,17 +166,15 @@ async function processDevices (from, to, devices, data, userData, traccarInstanc
166
166
 
167
167
  if (userData.groupByDay) {
168
168
  if (trips.length > 0) {
169
- const days = []
170
169
  const trips = deviceTrips.filter(t => userData.allWeek || !userData.weekDays || isInsideTimetable(t, userData) || isPartialInsideTimetable(t, userData, deviceRoute))
171
170
  const dates = getDates(from, to, userData.user.attributes.timezone || getUserPartner(userData.user).timezone)
172
- for (const date of dates) {
171
+ const days = await Promise.all(dates.map(async date => {
173
172
  const { tripsByDay } = await getDataByDay(d, date, { trips }, userData, traccarInstance)
174
- const day = {
173
+ return {
175
174
  date,
176
175
  kms: tripsByDay.reduce((a, b) => a + b.distance, 0)
177
176
  }
178
- days.push(day)
179
- }
177
+ }))
180
178
 
181
179
  devicesResult.push({
182
180
  device: d,