fleetmap-reports 2.0.166 → 2.0.168
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/RapportPerformance.xlsx +0 -0
- package/lang/enGB.js +1 -0
- package/lang/esCL.js +1 -0
- package/lang/frFR.json +1 -0
- package/lang/ptBR.js +1 -0
- package/lang/ptPT.js +1 -0
- package/package.json +1 -1
- package/src/index.js +3 -0
- package/src/partnerReports/dailyuse-report.js +73 -1
- package/src/partnerReports/passenger-report.js +46 -0
- package/src/sensor-report.js +77 -1
- package/src/templates/SensorReportTemplate.mjml +58 -0
- package/src/tests/dailyuse.test.js +19 -0
- package/src/tests/gpsjump.test.js +23 -0
- package/src/tests/kms.test.js +2 -1
- package/src/tests/zones.test.js +17 -0
|
Binary file
|
package/lang/enGB.js
CHANGED
package/lang/esCL.js
CHANGED
|
@@ -183,6 +183,7 @@ module.exports = {
|
|
|
183
183
|
titleIdleReport: 'Informe de Ralenti',
|
|
184
184
|
titleMachinesReport: 'Informe de Maquinas',
|
|
185
185
|
titleStopReport: 'Informe de Paradas',
|
|
186
|
+
titleSensorReport: 'Informe de Sensores',
|
|
186
187
|
from: 'De',
|
|
187
188
|
to: 'a',
|
|
188
189
|
headerStartAddress: 'Lugar de início',
|
package/lang/frFR.json
CHANGED
|
@@ -195,6 +195,7 @@
|
|
|
195
195
|
"titleStopReport": "Arrêter le rapport",
|
|
196
196
|
"titleDelayedStartReport": "Rapport de Departs Tardifs",
|
|
197
197
|
"titleDriverRankingReport": "Rapport d'conducteur",
|
|
198
|
+
"titleSensorReport": "Sensor Report",
|
|
198
199
|
"from": "Dans",
|
|
199
200
|
"to": "Le",
|
|
200
201
|
"headerStartAddress": "lieu de départ",
|
package/lang/ptBR.js
CHANGED
|
@@ -185,6 +185,7 @@ module.exports = {
|
|
|
185
185
|
titleIdleReport: 'Relatórios de Ralenti',
|
|
186
186
|
titleMachinesReport: 'Relatório de Máquinas',
|
|
187
187
|
titleStopReport: 'Relatório de Paragens',
|
|
188
|
+
titleSensorReport: 'Relatório de Sensores',
|
|
188
189
|
from: 'De',
|
|
189
190
|
to: 'a',
|
|
190
191
|
headerStartAddress: 'Local de início',
|
package/lang/ptPT.js
CHANGED
|
@@ -191,6 +191,7 @@ module.exports = {
|
|
|
191
191
|
titleIdleReport: 'Relatórios de Ralenti',
|
|
192
192
|
titleMachinesReport: 'Relatório de Máquinas',
|
|
193
193
|
titleStopReport: 'Relatório de Paragens',
|
|
194
|
+
titleSensorReport: 'Relatório de Sensores',
|
|
194
195
|
from: 'De',
|
|
195
196
|
to: 'a',
|
|
196
197
|
headerStartAddress: 'Local de início',
|
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -237,5 +237,8 @@ function Reports (config, axios) {
|
|
|
237
237
|
this.sensorReport = (from, to, userData) => {
|
|
238
238
|
return require('./sensor-report').create(from, to, userData, this.traccar)
|
|
239
239
|
}
|
|
240
|
+
this.sensorReportToPDF = (userData, reportData) => {
|
|
241
|
+
return require('./sensor-report').exportToPDF(userData, reportData)
|
|
242
|
+
}
|
|
240
243
|
}
|
|
241
244
|
module.exports = Reports
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
const traccarHelper = require('../util/traccar')
|
|
2
2
|
const { isInsideTimetable } = require('../util/trips')
|
|
3
|
-
const { convertFromUTCDate } = require('../util/utils')
|
|
3
|
+
const { convertFromUTCDate, getTranslations, convertMS, convertToLocaleTimeString, isClientSide } = require('../util/utils')
|
|
4
4
|
const automaticReports = require('../automaticReports')
|
|
5
|
+
const jsPDF = require('jspdf')
|
|
6
|
+
const { getStyle } = require('../reportStyle')
|
|
7
|
+
const { getUserPartner } = require('fleetmap-partners')
|
|
8
|
+
const { addTable, headerFromUser } = require('../util/pdfDocument')
|
|
5
9
|
|
|
6
10
|
async function createDailyUseReport (from, to, userData, traccar) {
|
|
7
11
|
const reportData = []
|
|
@@ -77,4 +81,72 @@ function processDeviceData (allInOne, d, userData) {
|
|
|
77
81
|
}
|
|
78
82
|
}
|
|
79
83
|
|
|
84
|
+
async function exportDailyUseReportToPDF (userData, reportData) {
|
|
85
|
+
const translations = getTranslations(userData)
|
|
86
|
+
const timezone = userData.user.attributes.timezone
|
|
87
|
+
const lang = userData.user.attributes.lang || (isClientSide() && navigator.language)
|
|
88
|
+
|
|
89
|
+
const headers = [
|
|
90
|
+
translations.report.vehicle,
|
|
91
|
+
'Immatriculation',
|
|
92
|
+
'Groupe',
|
|
93
|
+
'Matin départ',
|
|
94
|
+
'Matin arrêt',
|
|
95
|
+
'Matin temps',
|
|
96
|
+
'Déjeuner',
|
|
97
|
+
'Après-midi départ',
|
|
98
|
+
'Après-midi arrêt',
|
|
99
|
+
'Après-midi temps',
|
|
100
|
+
'Total temps',
|
|
101
|
+
'Total conduit',
|
|
102
|
+
'Total arrêts',
|
|
103
|
+
'Total kms'
|
|
104
|
+
]
|
|
105
|
+
|
|
106
|
+
const data = []
|
|
107
|
+
reportData.forEach(d => {
|
|
108
|
+
const row = [
|
|
109
|
+
d.device,
|
|
110
|
+
d.licensePlate,
|
|
111
|
+
d.group,
|
|
112
|
+
convertToLocaleTimeString(d.morningStart, lang, timezone, userData.user),
|
|
113
|
+
convertToLocaleTimeString(d.morningEnd, lang, timezone, userData.user),
|
|
114
|
+
convertMS(d.morningTime),
|
|
115
|
+
convertMS(d.lunch),
|
|
116
|
+
convertToLocaleTimeString(d.afternoonStart, lang, timezone, userData.user),
|
|
117
|
+
convertToLocaleTimeString(d.afternoonEnd, lang, timezone, userData.user),
|
|
118
|
+
convertMS(d.afternoonTime),
|
|
119
|
+
convertMS(d.totalTime),
|
|
120
|
+
convertMS(d.totalDrivingTime),
|
|
121
|
+
d.totalStops,
|
|
122
|
+
(d.totalDistance / 100).toFixed(1)
|
|
123
|
+
]
|
|
124
|
+
data.push(row)
|
|
125
|
+
})
|
|
126
|
+
|
|
127
|
+
const doc = new jsPDF.jsPDF('l')
|
|
128
|
+
await headerFromUser(doc, 'Rapport de Performance', userData.user)
|
|
129
|
+
const style = getStyle(getUserPartner(userData.user))
|
|
130
|
+
|
|
131
|
+
const footValues = []
|
|
132
|
+
|
|
133
|
+
doc.setFontSize(11)
|
|
134
|
+
doc.text(new Date(userData.from).toLocaleString() + ' - ' + new Date(userData.to).toLocaleString(), 20, 33)
|
|
135
|
+
|
|
136
|
+
style.headerFontSize = 8
|
|
137
|
+
style.bodyFontSize = 7
|
|
138
|
+
const columnStyles = {}
|
|
139
|
+
for (let i = 3; i < 14; i++) {
|
|
140
|
+
columnStyles[i] = { halign: 'right' }
|
|
141
|
+
}
|
|
142
|
+
addTable(doc, headers, data, footValues, style, 40, columnStyles)
|
|
143
|
+
return doc
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
function exportDailyUseReportToExcel (userData, reportData) {
|
|
147
|
+
|
|
148
|
+
}
|
|
149
|
+
|
|
80
150
|
exports.createDailyUseReport = createDailyUseReport
|
|
151
|
+
exports.exportDailyUseReportToPDF = exportDailyUseReportToPDF
|
|
152
|
+
exports.exportDailyUseReportToExcel = exportDailyUseReportToExcel
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
async function createPassengerReport (from, to, userData, traccar) {
|
|
2
|
+
//const allDevices = await traccar.axios.get('/devices').then(d => d.data)
|
|
3
|
+
const devices = userData.devices
|
|
4
|
+
const drivers = await traccar.axios.get('/drivers').then(d => d.data)
|
|
5
|
+
const groups = await traccar.axios.get('/groups').then(d => d.data)
|
|
6
|
+
await Promise.all(groups.map(async g => {
|
|
7
|
+
const driversByGroup = await traccar.axios.get(`/drivers?groupId=${g.id}`).then(d => d.data)
|
|
8
|
+
driversByGroup.forEach(d => {
|
|
9
|
+
const _driver = drivers.find(a => a.id === d.id)
|
|
10
|
+
if (_driver) {
|
|
11
|
+
_driver.groupName = g.name
|
|
12
|
+
}
|
|
13
|
+
})
|
|
14
|
+
}))
|
|
15
|
+
const eventsUrl = `/reports/events?${devices.map(d => 'deviceId=' + d.id).join('&')
|
|
16
|
+
}&from=${from.toISOString()
|
|
17
|
+
}&to=${to.toISOString()
|
|
18
|
+
}`
|
|
19
|
+
const positionsUrl = `/reports/route?${devices.map(d => 'deviceId=' + d.id).join('&')
|
|
20
|
+
}&from=${from.toISOString()
|
|
21
|
+
}&to=${to.toISOString()
|
|
22
|
+
}`
|
|
23
|
+
const events = await traccar.axios.get(eventsUrl).then(d => d.data)
|
|
24
|
+
const positions = await traccar.axios.get(positionsUrl).then(d => d.data)
|
|
25
|
+
events.forEach(e => {
|
|
26
|
+
delete e.attributes
|
|
27
|
+
const driver = getDriver(e, positions, drivers)
|
|
28
|
+
const position = positions.find(p => p.id === e.positionId)
|
|
29
|
+
e.deviceName = devices.find(d => d.id === e.deviceId).name
|
|
30
|
+
e.groupName = driver.groupName || ''
|
|
31
|
+
e.fixtime = position && new Date(position.fixTime)
|
|
32
|
+
e.notes = driver && driver.attributes.notes
|
|
33
|
+
e.driverName = (driver && driver.name) || (position && position.attributes.driverUniqueId)
|
|
34
|
+
})
|
|
35
|
+
return events
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function getDriver (event, positions, drivers) {
|
|
39
|
+
const p = positions.find(p => p.id === event.positionId)
|
|
40
|
+
if (!p) { return '' }
|
|
41
|
+
const d = drivers.find(d => d.uniqueId === p.attributes.driverUniqueId)
|
|
42
|
+
if (!d) { return '' }
|
|
43
|
+
return d
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
exports.createPassengerReport = createPassengerReport
|
package/src/sensor-report.js
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
const automaticReports = require('./automaticReports')
|
|
2
2
|
const traccarHelper = require('./util/traccar')
|
|
3
|
-
const { devicesToProcess } = require('./util/device')
|
|
3
|
+
const { devicesToProcess, deviceName } = require('./util/device')
|
|
4
|
+
const { getTranslations, isClientSide, convertToLocaleString, convertMS } = require('./util/utils')
|
|
5
|
+
const jsPDF = require('jspdf')
|
|
6
|
+
const { headerFromUser, addTable } = require('./util/pdfDocument')
|
|
7
|
+
const { getStyle } = require('./reportStyle')
|
|
8
|
+
const { getUserPartner } = require('fleetmap-partners')
|
|
4
9
|
|
|
5
10
|
function processDevices (from, to, devices, data, userData) {
|
|
6
11
|
const result = []
|
|
@@ -69,4 +74,75 @@ async function create (from, to, userData, traccar) {
|
|
|
69
74
|
return result
|
|
70
75
|
}
|
|
71
76
|
|
|
77
|
+
async function exportToPDF (userData, reportData) {
|
|
78
|
+
console.log('exportSensorReportToPDF')
|
|
79
|
+
|
|
80
|
+
const timezone = userData.user.attributes.timezone
|
|
81
|
+
const translations = getTranslations(userData)
|
|
82
|
+
const lang = userData.user.attributes.lang || (isClientSide() && navigator.language)
|
|
83
|
+
const reportDataRows = reportData.devices
|
|
84
|
+
|
|
85
|
+
const headers = [
|
|
86
|
+
'Sensor',
|
|
87
|
+
translations.report.start,
|
|
88
|
+
translations.report.end,
|
|
89
|
+
'Estado',
|
|
90
|
+
translations.report.duration,
|
|
91
|
+
translations.report.endAddress
|
|
92
|
+
]
|
|
93
|
+
|
|
94
|
+
if (reportDataRows) {
|
|
95
|
+
// eslint-disable-next-line new-cap
|
|
96
|
+
const doc = new jsPDF.jsPDF('l')
|
|
97
|
+
await headerFromUser(doc, 'Relatório de Sensores', userData.user)
|
|
98
|
+
|
|
99
|
+
let index = 0
|
|
100
|
+
reportDataRows.forEach(function (d) {
|
|
101
|
+
if (d.rows.length) {
|
|
102
|
+
const data = []
|
|
103
|
+
const name = deviceName(d.device)
|
|
104
|
+
const group = userData.groups.find(g => d.device.groupId === g.id)
|
|
105
|
+
|
|
106
|
+
const space = index === 0 ? 8 : 0
|
|
107
|
+
if (index) {
|
|
108
|
+
doc.addPage()
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
doc.setFontSize(13)
|
|
112
|
+
doc.text(name, 20, space + 20)
|
|
113
|
+
doc.setFontSize(11)
|
|
114
|
+
doc.text(group ? translations.report.group + ': ' + group.name : '', 200, space + 20)
|
|
115
|
+
doc.text(convertToLocaleString(d.from, lang, timezone, userData.user) + ' - ' + convertToLocaleString(d.to, lang, timezone, userData.user), 20, space + 25)
|
|
116
|
+
|
|
117
|
+
d.rows.forEach(row => {
|
|
118
|
+
const temp = [
|
|
119
|
+
row.name,
|
|
120
|
+
convertToLocaleString(row.startTime, lang, timezone, userData.user),
|
|
121
|
+
convertToLocaleString(row.endTime, lang, timezone, userData.user),
|
|
122
|
+
row.valueDescription,
|
|
123
|
+
convertMS(row.duration),
|
|
124
|
+
row.endAddress
|
|
125
|
+
]
|
|
126
|
+
data.push(temp)
|
|
127
|
+
})
|
|
128
|
+
|
|
129
|
+
const footValues = []
|
|
130
|
+
|
|
131
|
+
const style = getStyle(getUserPartner(userData.user))
|
|
132
|
+
|
|
133
|
+
addTable(doc, headers, data, footValues, style, 40, {
|
|
134
|
+
4: { halign: 'right' }
|
|
135
|
+
})
|
|
136
|
+
|
|
137
|
+
index++
|
|
138
|
+
}
|
|
139
|
+
})
|
|
140
|
+
return doc
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
function exportToExcel (userData, reportData) {}
|
|
145
|
+
|
|
146
|
+
exports.exportToPDF = exportToPDF
|
|
147
|
+
exports.exportToExcel = exportToExcel
|
|
72
148
|
exports.create = create
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
<mjml>
|
|
2
|
+
<mj-head>
|
|
3
|
+
</mj-head>
|
|
4
|
+
<mj-body background-color="#fff" font-size="13px" padding-right="0px" padding-left="0px">
|
|
5
|
+
<mj-section padding="10px 5px 0px 5px" >
|
|
6
|
+
<mj-column width="60%" style="float: left" text-align="left">
|
|
7
|
+
<mj-text>
|
|
8
|
+
<span style="font-size:18px;font-weight: bold">{{ translations.titleSensorReport }}</span>
|
|
9
|
+
</mj-text>
|
|
10
|
+
</mj-column>
|
|
11
|
+
<mj-column width="40%">
|
|
12
|
+
<mj-image width="120px" :src="url + '/' + logo"></mj-image>
|
|
13
|
+
</mj-column>
|
|
14
|
+
</mj-section>
|
|
15
|
+
<mj-section v-for="(device, index) in reportData.devices" v-bind:key="device.deviceId" >
|
|
16
|
+
<mj-column>
|
|
17
|
+
<mj-wrapper border="1px solid #000000" padding="20px 10px">
|
|
18
|
+
<mj-table>
|
|
19
|
+
<tr style="font-size:12px">
|
|
20
|
+
<th colspan="4" style="text-align: left">
|
|
21
|
+
<span style="font-weight: bold;font-size:12px">{{device.device.name}}{{device.device.attributes.license_plate ? ', ' +device.device.attributes.license_plate : ''}}{{device.device.model ? ', ' + device.device.model : ''}}</span>
|
|
22
|
+
<span style="float:right; font-weight: bold;font-size:11px">{{ device.device.groupName ? translations.group + ': ' + device.device.groupName : ''}}</span><br/>
|
|
23
|
+
<span style="font-weight: bold;font-size:11px">{{ translations.from }} {{ device.from.toLocaleString(user.attributes.lang, { timeZone: user.attributes.timezone }) }} {{ translations.to }} {{ device.to.toLocaleString(user.attributes.lang, { timeZone: user.attributes.timezone }) }}</span>
|
|
24
|
+
</th>
|
|
25
|
+
</tr>
|
|
26
|
+
</mj-table>
|
|
27
|
+
<mj-table>
|
|
28
|
+
<tr :style="'font-size:10px;background-color:'+color+';color:white'">
|
|
29
|
+
<th>Sensores</th>
|
|
30
|
+
<th>{{ translations.start }}</th>
|
|
31
|
+
<th>{{ translations.end }}</th>
|
|
32
|
+
<th>Estado</th>
|
|
33
|
+
<th>{{ translations.duration }}</th>
|
|
34
|
+
</tr>
|
|
35
|
+
<mj-section v-for="(row, index) in device.rows" v-bind:key="trip.deviceId">
|
|
36
|
+
<tr :style="index%2 ? 'text-align: center;background-color:#E3E3E3' : 'text-align: center;background-color:#FFFFFF'" >
|
|
37
|
+
<td style="font-size:10px">{{row.name}}</td>
|
|
38
|
+
<td style="font-size:10px">{{new Date(row.startTime).toLocaleString(user.attributes.lang, { timeZone: user.attributes.timezone, hour12:false })}}</td>
|
|
39
|
+
<td style="font-size:10px">{{new Date(row.endTime).toLocaleString(user.attributes.lang, { timeZone: user.attributes.timezone, hour12:false })}}</td>
|
|
40
|
+
<td style="font-size:10px">{{convertMS(row.duration)}}</td>
|
|
41
|
+
</tr>
|
|
42
|
+
<tr :style="index%2 ? 'vertical-align: top;background-color:#E3E3E3' : 'vertical-align: top;background-color:#FFFFFF'" >
|
|
43
|
+
<td style="font-size:9px;padding-left: 5px" :colspan="reportData.xpert === true ? 12 : 10">{{ translations.endAddress }}: {{row.endAddress}}</td>
|
|
44
|
+
</tr>
|
|
45
|
+
</mj-section>
|
|
46
|
+
</mj-table>
|
|
47
|
+
</mj-wrapper>
|
|
48
|
+
</mj-column>
|
|
49
|
+
</mj-section>
|
|
50
|
+
<mj-section>
|
|
51
|
+
<mj-column width="100%">
|
|
52
|
+
<mj-text align="left" font-family="Ubuntu, Helvetica, Arial, sans-serif">
|
|
53
|
+
{{ translations.unsubscribeTripReport.replace('%url%', url) }}
|
|
54
|
+
</mj-text>
|
|
55
|
+
</mj-column>
|
|
56
|
+
</mj-section>
|
|
57
|
+
</mj-body>
|
|
58
|
+
</mjml>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const { getReports } = require('./index')
|
|
2
|
+
const assert = require('assert')
|
|
3
|
+
const { createDailyUseReport } = require('../partnerReports/dailyuse-report')
|
|
4
|
+
|
|
5
|
+
describe('dailyuse', function () {
|
|
6
|
+
// eslint-disable-next-line no-undef
|
|
7
|
+
it('dailyuse report', async () => {
|
|
8
|
+
const report = await getReports()
|
|
9
|
+
const userData = await report.getUserData()
|
|
10
|
+
|
|
11
|
+
const data = await createDailyUseReport(
|
|
12
|
+
new Date(Date.UTC(2023, 10, 1, 0, 0, 0, 0)),
|
|
13
|
+
new Date(Date.UTC(2023, 10, 6, 23, 59, 59, 0)),
|
|
14
|
+
userData,
|
|
15
|
+
report.traccar)
|
|
16
|
+
console.log(data)
|
|
17
|
+
assert.equal(data[0].consumption, 19.799999999999997)
|
|
18
|
+
}, 8000000)
|
|
19
|
+
})
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
const { getReports } = require('./index')
|
|
2
|
+
const assert = require('assert')
|
|
3
|
+
const { convertMS } = require('../util/utils')
|
|
4
|
+
const { createGPSJumpReport } = require('../partnerReports/gpsjump-report')
|
|
5
|
+
|
|
6
|
+
// eslint-disable-next-line no-undef
|
|
7
|
+
describe('gpsjump', function () {
|
|
8
|
+
// eslint-disable-next-line no-undef
|
|
9
|
+
it('gpsjump report', async () => {
|
|
10
|
+
const report = await getReports()
|
|
11
|
+
const userData = await report.getUserData()
|
|
12
|
+
userData.devices = userData.devices.filter(d => d.id === 22326)
|
|
13
|
+
const data = await createGPSJumpReport(
|
|
14
|
+
new Date(Date.UTC(2023, 6, 1, 0, 0, 0, 0)),
|
|
15
|
+
new Date(Date.UTC(2023, 6, 17, 23, 59, 59, 0)),
|
|
16
|
+
userData,
|
|
17
|
+
report.traccar)
|
|
18
|
+
console.log(data)
|
|
19
|
+
assert.equal(data[0].consumption, 19.799999999999997)
|
|
20
|
+
assert.equal(data[0].distance, 326.7657)
|
|
21
|
+
assert.equal(convertMS(data[1].time * 1000, false), '08:19')
|
|
22
|
+
}, 8000000)
|
|
23
|
+
})
|
package/src/tests/kms.test.js
CHANGED
|
@@ -65,10 +65,11 @@ describe('Kms_Reports', function () {
|
|
|
65
65
|
it('KmsReport by timezone marrocos', async () => {
|
|
66
66
|
const reports = await getReports(process.env.email, process.env.password)
|
|
67
67
|
const userData = await reports.getUserData()
|
|
68
|
+
userData.groupByDay = true
|
|
68
69
|
userData.devices = userData.devices.filter(d => d.id === 93497)
|
|
69
70
|
const data = await reports.kmsReport(convertFromLocal(new Date(2024, 2, 18, 0, 0, 0), userData.user.attributes.timezone), convertFromLocal(new Date(2024, 2, 18, 23, 59, 59), userData.user.attributes.timezone),
|
|
70
71
|
userData)
|
|
71
72
|
const device = data[0].devices.find(d => d.device.id === 93497)
|
|
72
|
-
assert.equal(device, 1)
|
|
73
|
+
assert.equal(device.days.length, 1)
|
|
73
74
|
}, 3000000)
|
|
74
75
|
})
|
package/src/tests/zones.test.js
CHANGED
|
@@ -159,4 +159,21 @@ describe('zones', function () {
|
|
|
159
159
|
console.log(first)
|
|
160
160
|
assert.equal(first.days[6].distanceOut, 867.0554430738234)
|
|
161
161
|
}, 4000000)
|
|
162
|
+
|
|
163
|
+
it('works with casais zones in columns 7', async () => {
|
|
164
|
+
const report = await getReports()
|
|
165
|
+
const userData = await report.getUserData()
|
|
166
|
+
userData.zonesByColumn = true
|
|
167
|
+
userData.devices = userData.devices.filter(d => d.id === 81166)
|
|
168
|
+
userData.geofences = userData.geofences.filter(g => g.name === 'baliza 1 - raio verde ' ||
|
|
169
|
+
g.name === 'baliza 2 - raio amarelo')
|
|
170
|
+
userData.onlyWithKmsOut = false
|
|
171
|
+
const result = await report.zoneReport(
|
|
172
|
+
new Date(Date.UTC(2023, 9, 9, 0, 0, 0, 0)),
|
|
173
|
+
new Date(Date.UTC(2023, 9, 31, 23, 59, 59, 0)),
|
|
174
|
+
userData)
|
|
175
|
+
const first = result[0].devices[0]
|
|
176
|
+
console.log(first)
|
|
177
|
+
assert.equal(first.days[17].distanceOut, 720.7985320478997)
|
|
178
|
+
}, 4000000)
|
|
162
179
|
})
|