fleetmap-reports 1.0.930 → 1.0.931

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.930",
3
+ "version": "1.0.931",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
package/src/util/trips.js CHANGED
@@ -40,7 +40,7 @@ async function calculatePartialTrip (device, startDate, endDate, route, t, tracc
40
40
  if (tripStart.getTime() < endDate.getTime() &&
41
41
  tripEnd.getTime() > endDate.getTime()) {
42
42
  // Trip starts inside time period and ends outside time period
43
- if (!route) {
43
+ if (!route && device) {
44
44
  const allInOneData = await traccarHelper.getAllInOne(traccarInstance, startDate, endDate, [device], true, false, false, false, undefined, undefined, 5, 1, undefined, true)
45
45
  route = allInOneData.route
46
46
  }
@@ -54,7 +54,7 @@ async function calculatePartialTrip (device, startDate, endDate, route, t, tracc
54
54
  if (tripStart.getTime() < startDate.getTime() &&
55
55
  new Date(t.endTime).getTime() > startDate.getTime()) {
56
56
  // Trip starts outside time period and ends inside time period
57
- if (!route) {
57
+ if (!route && device) {
58
58
  const allInOneData = await traccarHelper.getAllInOne(traccarInstance, startDate, endDate, [device], true, false, false, false, undefined, undefined, 5, 1, undefined, true)
59
59
  route = allInOneData.route
60
60
  }
@@ -68,7 +68,7 @@ async function calculatePartialTrip (device, startDate, endDate, route, t, tracc
68
68
  if (tripStart.getTime() < startDate.getTime() &&
69
69
  tripEnd.getTime() > startDate.getTime()) {
70
70
  // Trip starts outside time period and ends inside time period
71
- if (!route) {
71
+ if (!route && device) {
72
72
  const allInOneData = await traccarHelper.getAllInOne(traccarInstance, startDate, endDate, [device], true, false, false, false, undefined, undefined, 5, 1, undefined, true)
73
73
  route = allInOneData.route
74
74
  }
@@ -82,7 +82,7 @@ async function calculatePartialTrip (device, startDate, endDate, route, t, tracc
82
82
  if (tripStart.getTime() < endDate.getTime() &&
83
83
  tripEnd.getTime() > endDate.getTime()) {
84
84
  // Trip starts inside time period and ends outside time period
85
- if (!route) {
85
+ if (!route && device) {
86
86
  const allInOneData = await traccarHelper.getAllInOne(traccarInstance, startDate, endDate, [device], true, false, false, false, undefined, undefined, 5, 1, undefined, true)
87
87
  route = allInOneData.route
88
88
  }
@@ -104,7 +104,7 @@ function isPartialInsideTimetable (t, userData, route) {
104
104
  const startDate = isClientSide() ? startDateLocal : convertFromLocal(startDateLocal, userData.user.attributes.timezone)
105
105
  const endDate = isClientSide() ? endDateLocal : convertFromLocal(endDateLocal, userData.user.attributes.timezone)
106
106
 
107
- return calculatePartialTrip(startDate, endDate, route, t)
107
+ return calculatePartialTrip(undefined, startDate, endDate, route, t)
108
108
  }
109
109
 
110
110
  return false