fleetmap-reports 1.0.824 → 1.0.825

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fleetmap-reports",
3
- "version": "1.0.824",
3
+ "version": "1.0.825",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -85,7 +85,7 @@ async function processDevices (from, to, devices, data, traccar, userData) {
85
85
 
86
86
  if (!a.geofenceId) {
87
87
  const poi = getNearestPOI(a.position, userData.geofences)
88
- a.geofenceId = poi && poi.id
88
+ a.geofenceId = poi && poi.p.id
89
89
  }
90
90
  if (a.geofenceId) {
91
91
  const geofence = userData.geofences.find(g => g.id === a.geofenceId)
@@ -12,4 +12,16 @@ describe('events', function () {
12
12
  userData)
13
13
  console.log('result', result)
14
14
  }, 4000000)
15
+
16
+ it('works with pois', async () => {
17
+ const report = await getReports(process.env.USER_NOGARTEL, process.env.PASS_NOGARTEL)
18
+ const userData = await report.getUserData()
19
+ userData.devices = userData.devices.filter(d => d.name === 'EPA5I95')
20
+ userData.eventTypes = ['ignitionOn']
21
+ const result = await report.eventsReport(
22
+ new Date(Date.UTC(2023, 8, 11, 0, 0, 0, 0)),
23
+ new Date(Date.UTC(2023, 8, 11, 23, 59, 59, 0)),
24
+ userData)
25
+ console.log('result', result)
26
+ }, 4000000)
15
27
  })
@@ -16,7 +16,7 @@ axiosCookieJarSupport(axios)
16
16
 
17
17
  const getReports = async (email, password) => {
18
18
  try {
19
- console.log('email / pass', process.env.email, process.env.password)
19
+ console.log('email / pass', process.env.email || email, process.env.password || password)
20
20
  await new SessionApi(traccarConfig, null, axios).sessionPost(email || process.env.email, password || process.env.password)
21
21
  return new Index(traccarConfig, axios, cookieJar)
22
22
  } catch (e) {