fleetmap-reports 1.0.928 → 1.0.929

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.928",
3
+ "version": "1.0.929",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -214,14 +214,4 @@ function calculateRPMSections (route, min, max) {
214
214
  return sections
215
215
  }
216
216
 
217
- function exportPerformanceReportToPDF (userData, reportData) {
218
-
219
- }
220
-
221
- function exportPerformanceReportToExcel (userData, reportData) {
222
-
223
- }
224
-
225
217
  exports.createPerformanceReport = createPerformanceReport
226
- exports.exportPerformanceReportToPDF = exportPerformanceReportToPDF
227
- exports.exportPerformanceReportToExcel = exportPerformanceReportToExcel
@@ -45,19 +45,18 @@ describe('zones', function () {
45
45
 
46
46
  // eslint-disable-next-line no-undef
47
47
  it('works with casais zones in columns', async () => {
48
- const report = await getReports('fleetmap.joao.penas2@gmail.com', 'penas46881')
48
+ const report = await getReports(process.env.USER_CASAIS, process.env.PASS_CASAIS)
49
49
  const userData = await report.getUserData()
50
50
  userData.zonesByColumn = true
51
- userData.devices = userData.devices.filter(d => d.id === 81202)
52
- userData.geofences = userData.geofences.filter(g => g.name === 'baliza 1 - raio verde ' ||
53
- g.name === 'baliza 2 - raio amarelo')
54
- userData.onlyWithKmsOut = false
51
+ userData.devices = userData.devices.filter(d => d.name === 'G-1101-E Clio')
52
+ userData.geofences = userData.geofences.filter(g => g.name === 'baliza 1 - raio verde ')
53
+ userData.onlyWithKmsOut = true
55
54
  const result = await report.zoneReport(
56
- new Date(Date.UTC(2023, 6, 13, 0, 0, 0, 0)),
57
- new Date(Date.UTC(2023, 6, 13, 23, 59, 59, 0)),
55
+ new Date(Date.UTC(2023, 0, 1, 0, 0, 0, 0)),
56
+ new Date(Date.UTC(2023, 0, 31, 23, 59, 59, 0)),
58
57
  userData)
59
- const first = result[0].devices[0]
58
+ const first = result[0].devices[0].days[0]
60
59
  console.log(first)
61
- assert.equal(first.days[0].distanceOut, 28)
60
+ assert.equal(first.distanceOut, 35.52274536571346)
62
61
  }, 4000000)
63
62
  })
@@ -262,7 +262,7 @@ function getAnyNextIn (outDate, alerts, deviceRoute) {
262
262
  .filter(a => a.type === 'geofenceEnter')
263
263
  .find(a => new Date(a.position.fixTime).getTime() > outDate)
264
264
 
265
- if (!alerts.filter(a => a.type === 'geofenceExit' &&
265
+ if (next && !alerts.filter(a => a.type === 'geofenceExit' &&
266
266
  new Date(a.position.fixTime).getTime() > outDate &&
267
267
  new Date(a.position.fixTime).getTime() < new Date(next.position.fixTime).getTime()).length) {
268
268
  return (next && next.position && new Date(next.position.fixTime).getTime()) ||