fleetmap-reports 1.0.585 → 1.0.587

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/frFR.js CHANGED
@@ -161,6 +161,32 @@ module.exports = {
161
161
  delete_geofence: 'Delete'
162
162
  },
163
163
  report: {
164
+ select_vehicles: 'Select vehicles',
165
+ select_vehicles_placeholder: 'Vehicles',
166
+ select_geofences: 'Select geofences',
167
+ select_geofences_placeholder: 'Geofences',
168
+ select_period: 'Select period',
169
+ period: 'Period',
170
+ date_start: 'Start date',
171
+ date_end: 'End date',
172
+ generate_report: 'Generate report',
173
+ validate_period: 'Por favor seleccione o período',
174
+ titleTripReport: 'Trip Report',
175
+ titleLocationReport: 'Locations Report',
176
+ titleSpeedingReport: 'Overspeed Report',
177
+ titleZoneReport: 'Zone Report',
178
+ titleRefuelReport: 'Refueling Report',
179
+ titleFuelConsumptionReport: 'Fuel Consumption Report',
180
+ titleFuelDropReport: 'Fuel Drop Report',
181
+ titleEventsReport: 'Events Report',
182
+ titleActivityReport: 'Activity Report',
183
+ titleKmsReport: 'Kms Report',
184
+ titleIdleReport: 'Idle Report',
185
+ titleMachinesReport: 'Machines Report',
186
+ headerStartAddress: 'Start address',
187
+ headerDistance: 'Distance',
188
+ headerDrivingTime: 'Driving Time',
189
+ headerMaxSpeed: 'Max Speed',
164
190
  closed: 'Door Closed',
165
191
  opened: 'Door Opened',
166
192
  sun: 'Sun',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fleetmap-reports",
3
- "version": "1.0.585",
3
+ "version": "1.0.587",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -17,6 +17,5 @@ describe('Test_Reports', function () {
17
17
  assert.equal(data.length, 1)
18
18
  const device = data[0].devices.find(d => d.device.id === deviceId)
19
19
  assert.equal(device.trips.length, 9) // Total Trips
20
- console.log(device.trips)
21
20
  }, 30000)
22
21
  })
@@ -27,7 +27,7 @@ describe('Test_Reports', function () {
27
27
  new Date(Date.UTC(2022, 9, 22, 0, 0, 0, 0)),
28
28
  new Date(Date.UTC(2022, 9, 22, 23, 59, 59, 0)),
29
29
  userData)
30
- console.log(await report.speedingReportToPDF(userData, data))
30
+ await report.speedingReportToPDF(userData, data)
31
31
  }, 40000)
32
32
 
33
33
  it('converts madrid time', async () => {
@@ -276,7 +276,7 @@ describe('Test_Reports', function () {
276
276
  assert.equal(data.length, 1)
277
277
  const device = data[0].devices.find(d => d.device.id === 22326)
278
278
  assert.equal(device.summary[0].startOdometer, 122502742.59)
279
- assert.equal(device.summary[0].distance, 1427562.359999925)
279
+ assert.equal(device.summary[0].distance, 1425532.6071218813)
280
280
  assert.equal(device.summary[0].startTime, '2022-01-01T13:35:47.000+0000')
281
281
  assert.equal(device.summary[0].endTime, '2022-01-31T17:36:27.000+0000')
282
282
  }, 80000)
@@ -330,7 +330,7 @@ describe('Test_Reports', function () {
330
330
  assert.equal(tripsReport.length, 1)
331
331
  const device1 = tripsReport[0].devices.find(d => d.device.id === 22327)
332
332
  assert.equal(device1.trips.length, 14) // Total Trips
333
- assert.equal(device1.totalDistance, 83553.13999999687) // Total Kms
333
+ assert.equal(device1.totalDistance, 85462.79000000097) // Total Kms
334
334
 
335
335
  const device2 = kmsReport[0].devices.find(d => d.device.id === 22327)
336
336
  assert.equal(device2.summary.distance, device1.totalDistance) // Total Kms
@@ -0,0 +1,15 @@
1
+ const { getReports } = require('./index')
2
+ describe('trips', function () {
3
+ it('converts to pdf', async () => {
4
+ const report = await getReports()
5
+ const userData = await report.getUserData()
6
+ userData.roadSpeedLimits = false
7
+ userData.customSpeed = false
8
+ userData.useVehicleSpeedLimit = true
9
+ const data = await report.tripReport(
10
+ new Date(Date.UTC(2022, 9, 22, 0, 0, 0, 0)),
11
+ new Date(Date.UTC(2022, 9, 22, 23, 59, 59, 0)),
12
+ userData)
13
+ await report.tripReportToPDF(userData, data)
14
+ }, 40000)
15
+ })
@@ -200,7 +200,6 @@ function processDevices (from, to, devices, data, userData, traccar) {
200
200
  if (trips[0].fuelConsumption !== undefined) {
201
201
  deviceData.totalFuelConsumption = trips.reduce((a, b) => a + b.fuelConsumption, 0)
202
202
  deviceData.avgFuelConsumption = deviceData.totalDistance > 0 ? (deviceData.totalFuelConsumption * 100) / (deviceData.totalDistance / 1000) : 0
203
- console.log(deviceData)
204
203
  }
205
204
 
206
205
  devicesResult.push(deviceData)
@@ -358,6 +357,9 @@ async function exportTripReportToPDF (userData, reportData) {
358
357
  headers, data, footValues, style,
359
358
  space + (userData.allWeek ? 40 : 45),
360
359
  {
360
+ 4: { halign: 'right' },
361
+ 5: { halign: 'right' },
362
+ 6: { halign: 'right' },
361
363
  7: { halign: 'right' },
362
364
  8: { halign: 'right' },
363
365
  9: { halign: 'right' },