fleetmap-reports 1.0.596 → 1.0.598
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
|
@@ -204,7 +204,7 @@ async function exportFuelConsumptionReportToPDF (userData, reportData) {
|
|
|
204
204
|
r.date,
|
|
205
205
|
(r.distance / 1000).toFixed(1),
|
|
206
206
|
r.spentFuel > 0 ? r.spentFuel : 0,
|
|
207
|
-
lang === 'pt-BR' ? r.avgConsumption.byLiters : r.avgConsumption.byKms,
|
|
207
|
+
lang === 'pt-BR' ? (r.avgConsumption.byLiters).toFixed(1) : (r.avgConsumption.byKms).toFixed(1),
|
|
208
208
|
new Date(r.duration).toLocaleTimeString(),
|
|
209
209
|
(r.endOdometer / 1000).toFixed(1),
|
|
210
210
|
r.refueling
|
package/src/refueling-report.js
CHANGED
|
@@ -32,7 +32,7 @@ async function createRefuelingReport (from, to, userData, traccar) {
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
const fuelServicesData = []
|
|
35
|
-
if (
|
|
35
|
+
if (devices.some(d => d.attributes.odooId)) {
|
|
36
36
|
fuelServicesData.push(...(await odoo.getOdooFuelServices(traccar, from, to)))
|
|
37
37
|
}
|
|
38
38
|
|
|
@@ -122,7 +122,7 @@ function coordsDistance (lon1, lat1, lon2, lat2) {
|
|
|
122
122
|
async function calculateRefuelingPositions (userData, d, data) {
|
|
123
123
|
const refuelingPositions = []
|
|
124
124
|
|
|
125
|
-
if (
|
|
125
|
+
if (d.attributes.odooId && !data.route[0].attributes.fuel) {
|
|
126
126
|
console.log(data.fuelServices)
|
|
127
127
|
data.fuelServices.forEach(s => {
|
|
128
128
|
const serviceDate = new Date(s.date)
|
|
@@ -133,7 +133,7 @@ async function calculateRefuelingPositions (userData, d, data) {
|
|
|
133
133
|
const quantity = s.liter
|
|
134
134
|
|
|
135
135
|
if (routeBeforeService.length) {
|
|
136
|
-
refuelingPositions.push({ date: s.date, diff: Number.parseFloat(quantity), cost: s.amount })
|
|
136
|
+
refuelingPositions.push({ position: routeBeforeService.slice(-1)[0], date: s.date, diff: Number.parseFloat(quantity), cost: s.amount })
|
|
137
137
|
}
|
|
138
138
|
})
|
|
139
139
|
} else {
|
package/src/speeding-report.js
CHANGED
|
@@ -135,7 +135,7 @@ async function getEvents (traccarInstance, from, to, devices, userData, deviceCo
|
|
|
135
135
|
|
|
136
136
|
const events = []
|
|
137
137
|
if (userData.roadSpeedLimits) {
|
|
138
|
-
const hereResults = await getHereEvents(devices, routes, userData.maxSpeedThreshold, userData.
|
|
138
|
+
const hereResults = await getHereEvents(devices, routes, userData.maxSpeedThreshold, userData.minimumIdleTime)
|
|
139
139
|
console.log('got', hereResults.length, 'from here')
|
|
140
140
|
events.push(...hereResults)
|
|
141
141
|
} else if (!userData.useVehicleSpeedLimit && userData.customSpeed) {
|
package/src/tests/index.test.js
CHANGED
|
@@ -23,7 +23,7 @@ describe('speeding tests', function () {
|
|
|
23
23
|
assert.equal(device.alerts.length, 104) // Total Alerts
|
|
24
24
|
console.log(device.alerts)
|
|
25
25
|
|
|
26
|
-
userData.
|
|
26
|
+
userData.minimumIdleTime = 1
|
|
27
27
|
const r = await getSpeedingReport(report, userData)
|
|
28
28
|
r.device.alerts.forEach(a => assert.equal(true, a.eventTime >= 60000))
|
|
29
29
|
assert.equal(r.device.alerts.length, 6) // Total Alerts
|
package/src/trip-report.js
CHANGED
|
@@ -172,8 +172,8 @@ function processDevices (from, to, devices, data, userData, traccar) {
|
|
|
172
172
|
const stop = getStop(new Date(trip.startTime), stops)
|
|
173
173
|
|
|
174
174
|
if (stop && !trip.endTimeIsOut) {
|
|
175
|
-
trip.stopDuration = (new Date(stop.endTime) - new Date(stop.startTime))
|
|
176
|
-
trip.stopEngineHours = trip.idleTime + stop.
|
|
175
|
+
trip.stopDuration = ((new Date(stop.endTime) - new Date(stop.startTime)) - stop.engineHours)
|
|
176
|
+
trip.stopEngineHours = trip.idleTime + stop.engineHours
|
|
177
177
|
} else {
|
|
178
178
|
trip.stopDuration = 0
|
|
179
179
|
trip.stopEngineHours = 0
|