fleetmap-reports 1.0.826 → 1.0.828
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/lang/frFR.json
CHANGED
|
@@ -157,6 +157,8 @@
|
|
|
157
157
|
"delete_geofence": "Éteindre"
|
|
158
158
|
},
|
|
159
159
|
"report": {
|
|
160
|
+
"geofenceOut": "Sortie",
|
|
161
|
+
"geofenceIn": "Entré",
|
|
160
162
|
"distanceIn": "Kms à l'intérieur",
|
|
161
163
|
"distanceOut": "Kms à l'extérieur",
|
|
162
164
|
"period": "Période",
|
|
@@ -217,7 +219,7 @@
|
|
|
217
219
|
"ignition": "Allumage",
|
|
218
220
|
"ignitionOn": "Sur",
|
|
219
221
|
"ignitionOff": "désactivé",
|
|
220
|
-
"enter": "
|
|
222
|
+
"enter": "Entre",
|
|
221
223
|
"exit": "Sortie",
|
|
222
224
|
"geofence": "Zone",
|
|
223
225
|
"duration": "Durée",
|
package/package.json
CHANGED
package/src/activity-report.js
CHANGED
|
@@ -205,7 +205,7 @@ function processDevices (from, to, devices, data, userData) {
|
|
|
205
205
|
const summaryCurrentDay = { date, deviceId: d.id }
|
|
206
206
|
summaryCurrentDay.engineHours = tripsByDay.reduce((a, b) => a + b.duration, 0)
|
|
207
207
|
summaryCurrentDay.distance = distance
|
|
208
|
-
summaryCurrentDay.averageSpeed = distance > 0 ? ((
|
|
208
|
+
summaryCurrentDay.averageSpeed = distance > 0 ? ((tripsByDay.reduce((a, b) => a + (b.averageSpeed * b.distance), 0)) / distance) : 0
|
|
209
209
|
summaryCurrentDay.maxSpeed = tripsByDay.reduce((a, b) => { return a > b.maxSpeed ? a : b.maxSpeed }, 0)
|
|
210
210
|
summaryCurrentDay.convertedSpentFuel = calculateConsumption(d, { route: routeByDay })
|
|
211
211
|
summaryCurrentDay.startTime = tripsByDay.length && tripsByDay[0].startTime
|
|
@@ -6,11 +6,6 @@ const { convertToFeature, convertPositionToFeature } = require('../util/utils')
|
|
|
6
6
|
function calculateLastStopTime (stopTime, to, time) {
|
|
7
7
|
return stopTime + (to.getTime() - new Date(time).getTime())
|
|
8
8
|
}
|
|
9
|
-
|
|
10
|
-
function calculateFirstStopTime (stopTime, from, time) {
|
|
11
|
-
return stopTime + (new Date(time).getTime() - from.getTime())
|
|
12
|
-
}
|
|
13
|
-
|
|
14
9
|
async function createActivityReport (from, to, userData, traccarInstance) {
|
|
15
10
|
const unauthorizedGeofences = []
|
|
16
11
|
const authorizedGeofences = []
|
|
@@ -72,4 +72,14 @@ describe('activity report', function () {
|
|
|
72
72
|
console.log(device)
|
|
73
73
|
assert.equal(device.summary.reduce((a, b) => a + b.convertedSpentFuel, 0), 168.79999999999995)
|
|
74
74
|
}, 800000)
|
|
75
|
+
it('Activity test performance', async () => {
|
|
76
|
+
const report = await getReports('q.trans', 'quality1214')
|
|
77
|
+
const userData = await report.getUserData()
|
|
78
|
+
console.log(userData)
|
|
79
|
+
userData.groupByDay = true
|
|
80
|
+
const data = await report.activityReport(new Date(2023, 7, 1, 0, 0, 0, 0),
|
|
81
|
+
new Date(2023, 31, 5, 23, 59, 59, 0),
|
|
82
|
+
userData)
|
|
83
|
+
assert.equal(data.length, 1)
|
|
84
|
+
}, 8000000)
|
|
75
85
|
})
|
package/src/tests/zones.test.js
CHANGED
|
@@ -32,6 +32,18 @@ describe('zones', function () {
|
|
|
32
32
|
console.log('result', result)
|
|
33
33
|
}, 4000000)
|
|
34
34
|
|
|
35
|
+
it('works with afriquia', async () => {
|
|
36
|
+
const report = await getReports(process.env.USER_AFRIQUIA, process.env.PASS_AFRIQUIA)
|
|
37
|
+
const userData = await report.getUserData()
|
|
38
|
+
console.log(userData.devices.length)
|
|
39
|
+
console.log(userData.geofences)
|
|
40
|
+
const result = await report.zoneReport(
|
|
41
|
+
new Date(Date.UTC(2023, 5, 11, 0, 0, 0, 0)),
|
|
42
|
+
new Date(Date.UTC(2023, 5, 11, 23, 59, 59, 0)),
|
|
43
|
+
userData)
|
|
44
|
+
console.log('result', result)
|
|
45
|
+
}, 4000000)
|
|
46
|
+
|
|
35
47
|
// eslint-disable-next-line no-undef
|
|
36
48
|
it('works with casais', async () => {
|
|
37
49
|
const report = await getReports(process.env.USER_CASAIS, process.env.PASS_CASAIS)
|