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.
@@ -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 trips distance because imported positions generate trips with 0 kms">
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/util/trips.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/util/trips.js" afterDir="false" />
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="10241000" />
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
- <option name="localTasksCounter" value="16" />
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
- <option name="LAST_COMMIT_MESSAGE" value="Fix trips distance because imported positions generate trips with 0 kms" />
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
@@ -162,7 +162,6 @@ module.exports = {
162
162
  },
163
163
  report: {
164
164
  temperature: 'Temperatura',
165
- temperature2: 'Temperatura2',
166
165
  select_vehicles: 'Select vehicles',
167
166
  select_vehicles_placeholder: 'Vehicles',
168
167
  select_geofences: 'Select geofences',
package/lang/esCL.js CHANGED
@@ -157,7 +157,6 @@ module.exports = {
157
157
  },
158
158
  report: {
159
159
  temperature: 'Temperatura',
160
- temperature2: 'Temperatura2',
161
160
  select_vehicles: 'Seleccione vehículos',
162
161
  select_vehicles_placeholder: 'Vehículos',
163
162
  select_geofences: 'Seleccione geocercas',
package/lang/ptBR.js CHANGED
@@ -154,7 +154,6 @@ module.exports = {
154
154
  },
155
155
  report: {
156
156
  temperature: 'Temperatura',
157
- temperature2: 'Temperatura2',
158
157
  select_vehicles: 'Seleccionar veículos',
159
158
  select_vehicles_placeholder: 'Veículos',
160
159
  select_geofences: 'Seleccionar balizas',
package/lang/ptPT.js CHANGED
@@ -158,7 +158,6 @@ module.exports = {
158
158
  },
159
159
  report: {
160
160
  temperature: 'Temperatura',
161
- temperature2: 'Temperatura2',
162
161
  select_vehicles: 'Seleccionar veículos',
163
162
  select_vehicles_placeholder: 'Veículos',
164
163
  select_geofences: 'Seleccionar balizas',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fleetmap-reports",
3
- "version": "1.0.255",
3
+ "version": "1.0.259",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
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
  })
@@ -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
- return new Date(location.fixTime).toLocaleString(user.attributes.lang, {
255
- timeZone: user.attributes.timezone,
256
- hour12: false
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) {
@@ -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 => {