fleetmap-reports 1.0.900 → 1.0.901

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.900",
3
+ "version": "1.0.901",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -6,6 +6,11 @@ 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
+
9
14
  async function createActivityReport (from, to, userData, traccarInstance) {
10
15
  const unauthorizedGeofences = []
11
16
  const authorizedGeofences = []
@@ -11,13 +11,12 @@ function isInside (start, end, userData) {
11
11
  const startDate = isClientSide() ? startDateLocal : convertFromLocal(startDateLocal, userData.user.attributes.timezone)
12
12
  const endDate = isClientSide() ? endDateLocal : convertFromLocal(endDateLocal, userData.user.attributes.timezone)
13
13
 
14
- // Trips inside time period
15
- if (startDate.getTime() < endDate.getTime()) {
16
- return tripStart.getTime() > startDate.getTime() && tripEnd.getTime() < endDate.getTime()
17
- } else {
18
- return (tripStart.getTime() < endDate.getTime() && tripEnd.getTime() < endDate.getTime()) ||
19
- (tripStart.getTime() > startDate.getTime())
14
+ // next day
15
+ if (startDate.getTime() > endDate.getTime()) {
16
+ endDate.setDate(endDate.getDate() + 1)
20
17
  }
18
+ // Trips inside time period
19
+ return tripStart.getTime() > startDate.getTime() && tripEnd.getTime() < endDate.getTime()
21
20
  }
22
21
 
23
22
  return false