fleetmap-reports 1.0.255 → 1.0.259
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/.idea/workspace.xml +16 -5
- package/lang/enGB.js +0 -1
- package/lang/esCL.js +0 -1
- package/lang/ptBR.js +0 -1
- package/lang/ptPT.js +0 -1
- package/package.json +1 -1
- package/src/index.test.js +11 -0
- package/src/location-report.js +11 -5
- package/src/util/driver.js +1 -2
package/.idea/workspace.xml
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
2
|
<project version="4">
|
|
3
3
|
<component name="ChangeListManager">
|
|
4
|
-
<list default="true" id="eb665c86-c893-4333-bd2a-721dc27980b9" name="Changes" comment="Fix
|
|
4
|
+
<list default="true" id="eb665c86-c893-4333-bd2a-721dc27980b9" name="Changes" comment="Fix reports by driver">
|
|
5
5
|
<change beforePath="$PROJECT_DIR$/package-lock.json" beforeDir="false" afterPath="$PROJECT_DIR$/package-lock.json" afterDir="false" />
|
|
6
6
|
<change beforePath="$PROJECT_DIR$/package.json" beforeDir="false" afterPath="$PROJECT_DIR$/package.json" afterDir="false" />
|
|
7
7
|
<change beforePath="$PROJECT_DIR$/src/index.test.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/index.test.js" afterDir="false" />
|
|
8
|
-
<change beforePath="$PROJECT_DIR$/src/
|
|
8
|
+
<change beforePath="$PROJECT_DIR$/src/location-report.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/location-report.js" afterDir="false" />
|
|
9
9
|
</list>
|
|
10
10
|
<option name="SHOW_DIALOG" value="false" />
|
|
11
11
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
|
@@ -212,7 +212,10 @@
|
|
|
212
212
|
<workItem from="1639592539998" duration="27141000" />
|
|
213
213
|
<workItem from="1639766010908" duration="4991000" />
|
|
214
214
|
<workItem from="1639872937953" duration="1438000" />
|
|
215
|
-
<workItem from="1639954341221" duration="
|
|
215
|
+
<workItem from="1639954341221" duration="11986000" />
|
|
216
|
+
<workItem from="1640272520380" duration="2253000" />
|
|
217
|
+
<workItem from="1640789226071" duration="1935000" />
|
|
218
|
+
<workItem from="1640794844118" duration="226000" />
|
|
216
219
|
</task>
|
|
217
220
|
<task id="LOCAL-00001" summary="Fix getStyle">
|
|
218
221
|
<created>1636983717385</created>
|
|
@@ -319,7 +322,14 @@
|
|
|
319
322
|
<option name="project" value="LOCAL" />
|
|
320
323
|
<updated>1640000462825</updated>
|
|
321
324
|
</task>
|
|
322
|
-
<
|
|
325
|
+
<task id="LOCAL-00016" summary="Fix reports by driver">
|
|
326
|
+
<created>1640274171902</created>
|
|
327
|
+
<option name="number" value="00016" />
|
|
328
|
+
<option name="presentableId" value="LOCAL-00016" />
|
|
329
|
+
<option name="project" value="LOCAL" />
|
|
330
|
+
<updated>1640274171902</updated>
|
|
331
|
+
</task>
|
|
332
|
+
<option name="localTasksCounter" value="17" />
|
|
323
333
|
<servers />
|
|
324
334
|
</component>
|
|
325
335
|
<component name="TypeScriptGeneratedFilesManager">
|
|
@@ -352,6 +362,7 @@
|
|
|
352
362
|
<MESSAGE value="fix speeding report" />
|
|
353
363
|
<MESSAGE value="Trip and activity report with time period" />
|
|
354
364
|
<MESSAGE value="Fix trips distance because imported positions generate trips with 0 kms" />
|
|
355
|
-
<
|
|
365
|
+
<MESSAGE value="Fix reports by driver" />
|
|
366
|
+
<option name="LAST_COMMIT_MESSAGE" value="Fix reports by driver" />
|
|
356
367
|
</component>
|
|
357
368
|
</project>
|
package/lang/enGB.js
CHANGED
package/lang/esCL.js
CHANGED
package/lang/ptBR.js
CHANGED
package/lang/ptPT.js
CHANGED
package/package.json
CHANGED
package/src/index.test.js
CHANGED
|
@@ -44,6 +44,17 @@ describe('Reports', function() {
|
|
|
44
44
|
|
|
45
45
|
console.log(reportData)
|
|
46
46
|
|
|
47
|
+
await reports.kmsReportToPDF(userData, reportData[0])
|
|
48
|
+
})
|
|
49
|
+
it('test locationReport by day', async () => {
|
|
50
|
+
const reports = await getReports()
|
|
51
|
+
const userData = await reports.getUserData()
|
|
52
|
+
userData.groupByDay = true
|
|
53
|
+
const reportData = await reports.locations(new Date(2021, 10, 1), new Date(2021, 10, 3),
|
|
54
|
+
userData)
|
|
55
|
+
|
|
56
|
+
console.log(reportData)
|
|
57
|
+
|
|
47
58
|
await reports.kmsReportToPDF(userData, reportData[0])
|
|
48
59
|
})
|
|
49
60
|
})
|
package/src/location-report.js
CHANGED
|
@@ -8,6 +8,8 @@ const {getUserPartner} = require("fleetmap-partners");
|
|
|
8
8
|
|
|
9
9
|
const fileName = 'LocationReport'
|
|
10
10
|
|
|
11
|
+
const clientSide = typeof window !== "undefined"
|
|
12
|
+
|
|
11
13
|
async function createLocationReport(from, to, userData, traccar) {
|
|
12
14
|
console.log('Create LocationReport')
|
|
13
15
|
|
|
@@ -112,7 +114,7 @@ async function exportLocationReportToPDF(userData, reportData) {
|
|
|
112
114
|
translations.report.speed,
|
|
113
115
|
translations.report.ignition,
|
|
114
116
|
translations.report.driver,
|
|
115
|
-
translations.temperature
|
|
117
|
+
translations.report.temperature
|
|
116
118
|
]
|
|
117
119
|
|
|
118
120
|
if (reportData.devices) {
|
|
@@ -251,10 +253,14 @@ function deviceName(device){
|
|
|
251
253
|
}
|
|
252
254
|
|
|
253
255
|
function getLocationDate(location, user){
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
256
|
+
if(clientSide) {
|
|
257
|
+
return new Date(location.fixTime).toLocaleString()
|
|
258
|
+
} else {
|
|
259
|
+
return new Date(location.fixTime).toLocaleString(user.attributes.lang, {
|
|
260
|
+
timeZone: user.attributes.timezone,
|
|
261
|
+
hour12: false
|
|
262
|
+
})
|
|
263
|
+
}
|
|
258
264
|
}
|
|
259
265
|
|
|
260
266
|
function getDriverName(location, drivers) {
|
package/src/util/driver.js
CHANGED
|
@@ -2,8 +2,7 @@ const traccar = require("./traccar");
|
|
|
2
2
|
|
|
3
3
|
//get devices used by each driver between two dates
|
|
4
4
|
async function devicesByDriver(traccarInstance, from, to, drivers, devices){
|
|
5
|
-
const eventsData = traccar.getEvents(traccarInstance, from, to , devices, ['driverChanged'])
|
|
6
|
-
|
|
5
|
+
const eventsData = await traccar.getEvents(traccarInstance, from, to , devices, ['driverChanged'])
|
|
7
6
|
const deviceIds = []
|
|
8
7
|
for(const d of drivers) {
|
|
9
8
|
const events = eventsData.filter(e => {
|