fleetmap-reports 2.0.357 → 2.0.358
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/.claude/worktrees/eager-stonebraker-c08ac7/.eslintrc.js +15 -0
- package/.claude/worktrees/eager-stonebraker-c08ac7/lang/enGB.js +309 -0
- package/.claude/worktrees/eager-stonebraker-c08ac7/lang/esCL.js +297 -0
- package/.claude/worktrees/eager-stonebraker-c08ac7/lang/frFR.json +324 -0
- package/.claude/worktrees/eager-stonebraker-c08ac7/lang/index.js +35 -0
- package/.claude/worktrees/eager-stonebraker-c08ac7/lang/ptBR.js +301 -0
- package/.claude/worktrees/eager-stonebraker-c08ac7/lang/ptPT.js +310 -0
- package/.claude/worktrees/eager-stonebraker-c08ac7/package-lock.json +11944 -0
- package/.claude/worktrees/eager-stonebraker-c08ac7/package.json +45 -0
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/activity-report.js +822 -0
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/automaticReports.js +34 -0
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/carbone/index.js +13 -0
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/custom/vistawasteActivity-report.js +544 -0
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/events-report.js +360 -0
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/fuel-consumption-report.js +296 -0
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/fuel-drop-report.js +128 -0
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/here.js +172 -0
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/idle-report.js +403 -0
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/index.js +244 -0
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/kms-report.js +549 -0
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/location-report.js +496 -0
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/machines-report.js +278 -0
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/partnerReports/afriquia.js +129 -0
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/partnerReports/dailyuse-report.js +80 -0
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/partnerReports/delayedstart-report.js +223 -0
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/partnerReports/driverranking-report.js +328 -0
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/partnerReports/gpsjump-report.js +61 -0
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/partnerReports/performance-report.js +359 -0
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/refueling-report.js +345 -0
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/reportStyle.js +34 -0
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/sensor-report.js +447 -0
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/speeding-report.js +663 -0
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/stop-report.js +242 -0
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/templates/ActivityReportTemplate.mjml +51 -0
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/templates/EmptyReportTemplate.mjml +25 -0
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/templates/EventsReportTemplate.mjml +75 -0
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/templates/FuelDropReportTemplate.mjml +60 -0
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/templates/IdleReportTemplate.mjml +54 -0
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/templates/KmsReportGroupByDayTemplate.mjml +43 -0
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/templates/KmsReportTemplate.mjml +44 -0
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/templates/LocationReportTemplate.mjml +37 -0
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/templates/RefuelingReportTemplate.mjml +60 -0
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/templates/SensorReportTemplate.mjml +23 -0
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/templates/SpeedingReportTemplate.mjml +80 -0
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/templates/TripReportTemplate.mjml +97 -0
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/templates/ZoneReportTemplate.mjml +52 -0
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/templates/report.mjml +96 -0
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/tests/activity.test.js +99 -0
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/tests/carbone.test.js +20 -0
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/tests/events.test.js +30 -0
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/tests/fuel.test.js +35 -0
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/tests/idle.test.js +16 -0
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/tests/index.js +24 -0
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/tests/index.test.js +203 -0
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/tests/kms.test.js +74 -0
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/tests/performance.test.js +36 -0
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/tests/positions.test.js +67 -0
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/tests/speeding.test.js +120 -0
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/tests/translations.test.js +21 -0
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/tests/trips.test.js +140 -0
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/tests/zones.test.js +162 -0
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/trip-report.js +641 -0
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/util/device.js +13 -0
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/util/driver.js +90 -0
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/util/fuel.js +102 -0
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/util/geofence.js +52 -0
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/util/odoo.js +18 -0
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/util/parallel.js +64 -0
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/util/pdfDocument.js +140 -0
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/util/route.js +78 -0
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/util/timetable.js +30 -0
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/util/traccar.js +213 -0
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/util/traccar.worker.js +49 -0
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/util/trips.js +270 -0
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/util/utils.js +358 -0
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/util/worker.js +14 -0
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/util/xpert.js +58 -0
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/word/index.js +95 -0
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/zone-report.js +904 -0
- package/lang/enGB.js +18 -0
- package/lang/esCL.js +18 -0
- package/lang/frFR.json +7 -1
- package/lang/ptBR.js +18 -0
- package/lang/ptPT.js +18 -0
- package/package.json +1 -1
- package/src/partnerReports/driverranking-report.js +149 -49
- package/src/util/pdfDocument.js +2 -1
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
const { getReports } = require('./index')
|
|
2
|
+
const assert = require('assert')
|
|
3
|
+
// eslint-disable-next-line no-undef
|
|
4
|
+
describe('zones', function () {
|
|
5
|
+
// eslint-disable-next-line no-undef
|
|
6
|
+
it('works tripsBetweenZones', async () => {
|
|
7
|
+
const report = await getReports()
|
|
8
|
+
const userData = await report.getUserData()
|
|
9
|
+
userData.tripsBetweenZones = true
|
|
10
|
+
const result = await report.zoneReport(
|
|
11
|
+
new Date(Date.UTC(2023, 6, 24, 0, 0, 0, 0)),
|
|
12
|
+
new Date(Date.UTC(2023, 7, 25, 23, 59, 59, 0)),
|
|
13
|
+
userData)
|
|
14
|
+
console.log(await report.zoneReportToPDF(userData, result[0]))
|
|
15
|
+
}, 4000000)
|
|
16
|
+
|
|
17
|
+
// eslint-disable-next-line no-undef
|
|
18
|
+
it('works with afriquia', async () => {
|
|
19
|
+
const report = await getReports(process.env.USER_AFRIQUIA, process.env.PASS_AFRIQUIA)
|
|
20
|
+
const userData = await report.getUserData()
|
|
21
|
+
console.log(userData.devices.length)
|
|
22
|
+
console.log(userData.geofences)
|
|
23
|
+
const result = await report.zoneReport(
|
|
24
|
+
new Date(Date.UTC(2023, 5, 11, 0, 0, 0, 0)),
|
|
25
|
+
new Date(Date.UTC(2023, 5, 11, 23, 59, 59, 0)),
|
|
26
|
+
userData)
|
|
27
|
+
console.log('result', result)
|
|
28
|
+
}, 4000000)
|
|
29
|
+
|
|
30
|
+
it('trips between geofences', async () => {
|
|
31
|
+
const report = await getReports(process.env.USER_MOVIFLOTTE, process.env.PASS_MOVIFLOTTE)
|
|
32
|
+
const userData = await report.getUserData()
|
|
33
|
+
userData.tripsBetweenZones = true
|
|
34
|
+
const result = await report.zoneReport(
|
|
35
|
+
new Date(Date.UTC(2024, 0, 8, 0, 0, 0, 0)),
|
|
36
|
+
new Date(Date.UTC(2024, 0, 8, 23, 59, 59, 0)),
|
|
37
|
+
userData)
|
|
38
|
+
console.log('result', result)
|
|
39
|
+
}, 4000000)
|
|
40
|
+
|
|
41
|
+
// eslint-disable-next-line no-undef
|
|
42
|
+
it('works with casais', async () => {
|
|
43
|
+
const report = await getReports(process.env.USER_CASAIS, process.env.PASS_CASAIS)
|
|
44
|
+
const userData = await report.getUserData()
|
|
45
|
+
userData.devices = userData.devices.filter(d => d.name === 'G-1101-E Clio')
|
|
46
|
+
userData.geofences = userData.geofences.filter(g => g.name === 'baliza 1 - raio verde ')
|
|
47
|
+
const result = await report.zoneReport(
|
|
48
|
+
new Date(Date.UTC(2023, 0, 1, 0, 0, 0, 0)),
|
|
49
|
+
new Date(Date.UTC(2023, 0, 31, 23, 59, 59, 0)),
|
|
50
|
+
userData)
|
|
51
|
+
const first = result[0].devices[0].geofences[0]
|
|
52
|
+
console.log(first)
|
|
53
|
+
assert.equal(first.inTime.fixTime, '2023-01-03T21:23:24.000+00:00')
|
|
54
|
+
assert.equal(first.outTime.fixTime, '2023-01-07T12:22:53.000+00:00')
|
|
55
|
+
}, 4000000)
|
|
56
|
+
|
|
57
|
+
// eslint-disable-next-line no-undef
|
|
58
|
+
it('works with casais zones in columns', async () => {
|
|
59
|
+
const report = await getReports()
|
|
60
|
+
const userData = await report.getUserData()
|
|
61
|
+
userData.zonesByColumn = true
|
|
62
|
+
userData.devices = userData.devices.filter(d => d.id === 81201)
|
|
63
|
+
userData.geofences = userData.geofences.filter(g => g.name === 'baliza 1 - raio verde ' ||
|
|
64
|
+
g.name === 'baliza 2 - raio amarelo')
|
|
65
|
+
userData.onlyWithKmsOut = false
|
|
66
|
+
const result = await report.zoneReport(
|
|
67
|
+
new Date(Date.UTC(2023, 7, 17, 0, 0, 0, 0)),
|
|
68
|
+
new Date(Date.UTC(2023, 7, 20, 23, 59, 59, 0)),
|
|
69
|
+
userData)
|
|
70
|
+
const first = result[0].devices[0]
|
|
71
|
+
console.log(first)
|
|
72
|
+
assert.equal(first.days[0].distanceOut, 0)
|
|
73
|
+
assert.equal(first.days[2].distanceOut, 0)
|
|
74
|
+
}, 4000000)
|
|
75
|
+
|
|
76
|
+
it('works with casais zones in columns 2', async () => {
|
|
77
|
+
const report = await getReports()
|
|
78
|
+
const userData = await report.getUserData()
|
|
79
|
+
userData.zonesByColumn = true
|
|
80
|
+
userData.devices = userData.devices.filter(d => d.id === 81201)
|
|
81
|
+
userData.geofences = userData.geofences.filter(g => g.name === 'baliza 1 - raio verde ' ||
|
|
82
|
+
g.name === 'baliza 2 - raio amarelo')
|
|
83
|
+
userData.onlyWithKmsOut = false
|
|
84
|
+
const result = await report.zoneReport(
|
|
85
|
+
new Date(Date.UTC(2023, 7, 7, 0, 0, 0, 0)),
|
|
86
|
+
new Date(Date.UTC(2023, 7, 7, 23, 59, 59, 0)),
|
|
87
|
+
userData)
|
|
88
|
+
const first = result[0].devices[0]
|
|
89
|
+
console.log(first)
|
|
90
|
+
assert.equal(first.days[0].distanceOut, 554.6037095121401)
|
|
91
|
+
}, 4000000)
|
|
92
|
+
|
|
93
|
+
it('works with casais zones in columns 3', async () => {
|
|
94
|
+
const report = await getReports()
|
|
95
|
+
const userData = await report.getUserData()
|
|
96
|
+
userData.zonesByColumn = true
|
|
97
|
+
userData.devices = userData.devices.filter(d => d.id === 81201)
|
|
98
|
+
userData.geofences = userData.geofences.filter(g => g.name === 'baliza 1 - raio verde ' ||
|
|
99
|
+
g.name === 'baliza 2 - raio amarelo')
|
|
100
|
+
userData.onlyWithKmsOut = false
|
|
101
|
+
const result = await report.zoneReport(
|
|
102
|
+
new Date(Date.UTC(2023, 8, 1, 0, 0, 0, 0)),
|
|
103
|
+
new Date(Date.UTC(2023, 8, 10, 23, 59, 59, 0)),
|
|
104
|
+
userData)
|
|
105
|
+
const first = result[0].devices[0]
|
|
106
|
+
console.log(first)
|
|
107
|
+
assert.equal(first.days[0].distanceOut, 294.0468270741282)
|
|
108
|
+
assert.equal(first.days[1].distanceOut, 35.21209134706803)
|
|
109
|
+
}, 4000000)
|
|
110
|
+
|
|
111
|
+
it('works with casais zones in columns 4', async () => {
|
|
112
|
+
const report = await getReports()
|
|
113
|
+
const userData = await report.getUserData()
|
|
114
|
+
userData.zonesByColumn = true
|
|
115
|
+
userData.devices = userData.devices.filter(d => d.id === 81164)
|
|
116
|
+
userData.geofences = userData.geofences.filter(g => g.name === 'baliza 1 - raio verde ' ||
|
|
117
|
+
g.name === 'baliza 2 - raio amarelo')
|
|
118
|
+
userData.onlyWithKmsOut = false
|
|
119
|
+
const result = await report.zoneReport(
|
|
120
|
+
new Date(Date.UTC(2023, 8, 10, 0, 0, 0, 0)),
|
|
121
|
+
new Date(Date.UTC(2023, 8, 11, 23, 59, 59, 0)),
|
|
122
|
+
userData)
|
|
123
|
+
const first = result[0].devices[0]
|
|
124
|
+
console.log(first)
|
|
125
|
+
assert.equal(first.days[0].distanceOut, 0)
|
|
126
|
+
assert.equal(first.days[1].distanceOut, 24)
|
|
127
|
+
}, 4000000)
|
|
128
|
+
|
|
129
|
+
it('works with casais zones in columns 5', async () => {
|
|
130
|
+
const report = await getReports()
|
|
131
|
+
const userData = await report.getUserData()
|
|
132
|
+
userData.zonesByColumn = true
|
|
133
|
+
userData.devices = userData.devices.filter(d => d.id === 81172)
|
|
134
|
+
userData.geofences = userData.geofences.filter(g => g.name === 'baliza 1 - raio verde ' ||
|
|
135
|
+
g.name === 'baliza 2 - raio amarelo')
|
|
136
|
+
userData.onlyWithKmsOut = false
|
|
137
|
+
const result = await report.zoneReport(
|
|
138
|
+
new Date(Date.UTC(2023, 8, 3, 0, 0, 0, 0)),
|
|
139
|
+
new Date(Date.UTC(2023, 8, 10, 23, 59, 59, 0)),
|
|
140
|
+
userData)
|
|
141
|
+
const first = result[0].devices[0]
|
|
142
|
+
console.log(first)
|
|
143
|
+
assert.equal(first.days[1].distanceOut, 298.9872662595749)
|
|
144
|
+
}, 4000000)
|
|
145
|
+
|
|
146
|
+
it('works with casais zones in columns 6', async () => {
|
|
147
|
+
const report = await getReports()
|
|
148
|
+
const userData = await report.getUserData()
|
|
149
|
+
userData.zonesByColumn = true
|
|
150
|
+
userData.devices = userData.devices.filter(d => d.id === 81166)
|
|
151
|
+
userData.geofences = userData.geofences.filter(g => g.name === 'baliza 1 - raio verde ' ||
|
|
152
|
+
g.name === 'baliza 2 - raio amarelo')
|
|
153
|
+
userData.onlyWithKmsOut = false
|
|
154
|
+
const result = await report.zoneReport(
|
|
155
|
+
new Date(Date.UTC(2023, 9, 1, 0, 0, 0, 0)),
|
|
156
|
+
new Date(Date.UTC(2023, 9, 27, 23, 59, 59, 0)),
|
|
157
|
+
userData)
|
|
158
|
+
const first = result[0].devices[0]
|
|
159
|
+
console.log(first)
|
|
160
|
+
assert.equal(first.days[6].distanceOut, 867.0554430738234)
|
|
161
|
+
}, 4000000)
|
|
162
|
+
})
|