fleetmap-reports 1.0.443 → 1.0.444
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 +1 -1
- package/src/events-report.js +1 -1
- package/src/index.test.js +0 -2
- package/src/util/odoo.js +7 -9
package/package.json
CHANGED
package/src/events-report.js
CHANGED
|
@@ -261,7 +261,7 @@ function getAlertInfo (drivers, alert) {
|
|
|
261
261
|
const driver = drivers.find(d => d.uniqueId === alert.attributes.driverUniqueId)
|
|
262
262
|
return driver ? driver.name : alert.attributes.driverUniqueId
|
|
263
263
|
}
|
|
264
|
-
return
|
|
264
|
+
return alert.driver
|
|
265
265
|
}
|
|
266
266
|
|
|
267
267
|
function getAlertDate (user, alert) {
|
package/src/index.test.js
CHANGED
|
@@ -15,12 +15,10 @@ async function getSpeedingReport (report, userData) {
|
|
|
15
15
|
|
|
16
16
|
// eslint-disable-next-line no-undef
|
|
17
17
|
describe('Test_Reports', function () {
|
|
18
|
-
this.timeout(500000)
|
|
19
18
|
// eslint-disable-next-line no-undef
|
|
20
19
|
it('Speeding by device', async () => {
|
|
21
20
|
const report = await getReports()
|
|
22
21
|
const userData = await report.getUserData()
|
|
23
|
-
userData.roadSpeedLimit = true
|
|
24
22
|
const { device, totalDistance, totalEventTime } = await getSpeedingReport(report, userData)
|
|
25
23
|
assert.equal(device.alerts.length, 15) // Total Alerts
|
|
26
24
|
assert.equal(totalDistance, 19.59984677533689) // Total Kms
|
package/src/util/odoo.js
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
|
|
2
|
-
async function getOdooFuelServices
|
|
3
|
-
|
|
2
|
+
async function getOdooFuelServices(traccar, from, to) {
|
|
3
|
+
const url = `/odoo/reports/refuelingServices?startDate=${from.toDateString()}&endDate=${to.toDateString()}`
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
withCredentials: true
|
|
9
|
-
})
|
|
5
|
+
const {data} = await traccar.axios.get(url,{
|
|
6
|
+
jar: traccar.cookieJar,
|
|
7
|
+
withCredentials: true })
|
|
10
8
|
|
|
11
|
-
|
|
9
|
+
console.log(data)
|
|
12
10
|
|
|
13
|
-
|
|
11
|
+
return data
|
|
14
12
|
}
|
|
15
13
|
|
|
16
14
|
exports.getOdooFuelServices = getOdooFuelServices
|