fleetmap-reports 1.0.366 → 1.0.369

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/lang/esCL.js CHANGED
@@ -192,7 +192,7 @@ module.exports = {
192
192
  stopTime: 'Parada',
193
193
  distance: 'Distancia',
194
194
  speed: 'Velocidad',
195
- overspeed: 'Alerta Ligado',
195
+ overspeed: 'Inicio del Alerta',
196
196
  roadSpeedLimit: 'Limite en la calle',
197
197
  avgSpeed: 'Vel.Média',
198
198
  maxSpeed: 'Vel.Max',
@@ -207,7 +207,7 @@ module.exports = {
207
207
  geofence: 'Geocerca',
208
208
  duration: 'Duracción',
209
209
  vehicles: 'Vehículos',
210
- vehicle: 'Vehicle',
210
+ vehicle: 'Vehículo',
211
211
  odometer: 'Cuentaquilómetros',
212
212
  startOdometer: 'Start (Km)',
213
213
  endOdometer: 'End (Km)',
@@ -220,7 +220,7 @@ module.exports = {
220
220
  totalFuelDropLiters: 'Total Fuel Lost',
221
221
  speedLimit: 'Límite de Velocidad',
222
222
  eventType: 'Evento',
223
- info: 'Informação',
223
+ info: 'Información',
224
224
  event_ignitionOff: 'Motor Apagado',
225
225
  event_ignitionOn: 'Motor Encendido',
226
226
  event_deviceOverspeed: 'Traspassos de velocidad',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fleetmap-reports",
3
- "version": "1.0.366",
3
+ "version": "1.0.369",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -205,7 +205,7 @@ async function exportSpeedingReportToPDF(userData, reportData) {
205
205
  }
206
206
 
207
207
  function exportSpeedingReportToExcel(userData, reportData) {
208
- console.log('Export to Excel')
208
+ console.log('exportSpeedingReportToExcel')
209
209
 
210
210
  const translations = getTranslations(userData)
211
211
 
@@ -226,7 +226,7 @@ function exportSpeedingReportToExcel(userData, reportData) {
226
226
  data = data.concat(d.alerts.map(a => {
227
227
  return {
228
228
  name: d.device.name,
229
- eventType: a.type === 'alarm' ? translations.report['event_'+a.attributes.alarm] : translations.report['event'+a.type],
229
+ eventType: a.type === 'alarm' ? translations.report['event_'+a.attributes.alarm] : translations.report['event_'+a.type],
230
230
  fixTime: getAlertDate(userData.user, a),
231
231
  address: a.geofenceName || (a.position ? a.position.address : ''),
232
232
  info: getAlertInfo(userData.drivers, a)
package/src/kms-report.js CHANGED
@@ -9,6 +9,7 @@ const {getDates, convertFromUTC} = require("./util/utils")
9
9
  const trips = require("./util/trips")
10
10
  const drivers = require("./util/driver")
11
11
  const { isInsideTimetable, isPartialInsideTimetable, calculateTrip} = require("./util/trips")
12
+ const traccarHelper = require("./util/traccar");
12
13
 
13
14
  const fileName = 'KmsReport'
14
15
 
@@ -46,14 +47,15 @@ async function createKmsReportByDevice(from, to, userData, traccarInstance) {
46
47
  }
47
48
 
48
49
  devicesToProcess.sort((a, b) => (a.name > b.name) ? 1 : -1)
49
- const route = await traccar.getRoute(traccarInstance, from, to, devicesToProcess)
50
- const tripsData = await traccar.getTrips(traccarInstance, from, to, devicesToProcess)
50
+ const allInOne = await traccarHelper.getAllInOne(traccarInstance, from, to, devicesToProcess, true, true, false, false)
51
+ const tripsData = allInOne.trips
52
+ const routeData = allInOne.route
51
53
 
52
54
  console.log('trips:' + tripsData.length)
53
55
 
54
56
  if (tripsData.length > 0) {
55
- trips.checkTripsKms(traccarInstance, from, to, devicesToProcess, {trips: tripsData, route: route})
56
- allData.devices = processDevices(from, to, devicesToProcess, {trips: tripsData, route: route}, userData)
57
+ trips.checkTripsKms(traccarInstance, from, to, devicesToProcess, {trips: tripsData, route: routeData})
58
+ allData.devices = processDevices(from, to, devicesToProcess, {trips: tripsData, route: routeData}, userData)
57
59
  }
58
60
 
59
61
  return allData
@@ -68,8 +70,10 @@ async function createKmsReportByDriver(from, to, userData, traccarInstance) {
68
70
  return { drivers: [] }
69
71
  }
70
72
 
71
- const tripsData = await traccar.getTrips(traccarInstance, from, to, devices)
72
- const routeData = await traccar.getRoute(traccarInstance, from, to, devices)
73
+ const allInOne = await traccarHelper.getAllInOne(traccarInstance, from, to, devices, true, true, false, false)
74
+ const tripsData = allInOne.trips
75
+ const routeData = allInOne.route
76
+
73
77
 
74
78
  return { drivers: processDrivers(from, to, userData, {trips: tripsData, route: routeData}) }
75
79
  }
@@ -54,7 +54,10 @@ async function createLocationReport(from, to, userData, traccar) {
54
54
 
55
55
  const arrayOfArrays = automaticReports.sliceArray(devicesToSlice)
56
56
  let data = []
57
+ let i = 0
57
58
  for (const a of arrayOfArrays) {
59
+ console.log(`PROGRESS_PERC:${++i/arrayOfArrays.length*100}`)
60
+ console.log('LOADING_MESSAGE:' + a.map(d => d.name).join(', '))
58
61
  const response = await traccar.reports.reportsRouteGet(from, to, a.map(d => d.id))
59
62
  data = data.concat(response.data)
60
63
  }