fleetmap-reports 1.0.803 → 1.0.805

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.803",
3
+ "version": "1.0.805",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -325,6 +325,11 @@ function getDigitalPortValue (row, index, translations, dAttributes) {
325
325
  ? dAttributes.sensor1on || row.attributes.sensor
326
326
  : dAttributes.sensor1off || row.attributes.sensor
327
327
  }
328
+ if (row.attributes && row.attributes[dAttributes.sensor1Attribute] !== undefined) {
329
+ return row.attributes[dAttributes.sensor1Attribute]
330
+ ? dAttributes.sensor1on || row.attributes.sensor
331
+ : dAttributes.sensor1off || row.attributes.sensor
332
+ }
328
333
  break
329
334
  case 2:
330
335
  if (row.attributes && row.attributes.door2) {
@@ -7,6 +7,10 @@ function calculateLastStopTime (stopTime, to, time) {
7
7
  return stopTime + (to.getTime() - new Date(time).getTime())
8
8
  }
9
9
 
10
+ function calculateFirstStopTime (stopTime, from, time) {
11
+ return stopTime + (new Date(time).getTime() - from.getTime())
12
+ }
13
+
10
14
  async function createActivityReport (from, to, userData, traccarInstance) {
11
15
  const unauthorizedGeofences = []
12
16
  const authorizedGeofences = []
@@ -122,6 +126,4 @@ async function createActivityReport (from, to, userData, traccarInstance) {
122
126
  return reportData
123
127
  }
124
128
 
125
-
126
-
127
129
  exports.createActivityReport = createActivityReport
@@ -7,9 +7,9 @@ describe('activity report', function () {
7
7
  it('Activity by device', async () => {
8
8
  const report = await getReports()
9
9
  const userData = await report.getUserData()
10
- userData.groupByDay = true
11
- const data = await report.activityReport(new Date(2023, 0, 1, 0, 0, 0, 0),
12
- new Date(2023, 0, 31, 23, 59, 59, 0),
10
+
11
+ const data = await report.activityReport(new Date(2022, 0, 1, 0, 0, 0, 0),
12
+ new Date(2022, 0, 31, 23, 59, 59, 0),
13
13
  userData)
14
14
  assert.equal(data.length, 1)
15
15
  const device = data[0].devices.find(d => d.device.id === 22326)