fleetmap-reports 2.0.286 → 2.0.289

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": "2.0.286",
3
+ "version": "2.0.289",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -73,7 +73,7 @@ async function createLocationReportByDriver (from, to, userData, traccar) {
73
73
  }
74
74
 
75
75
  async function _getDriverRoute (traccar, from, to, slice, deviceCount, devices, userData, retry = 3) {
76
- const url = `${process.env.PINME_FUNCTION_URL}/pinmeapi/process-report/get-driver-route`
76
+ const url = `https://${process.env.SERVER_HOST}/pinmeapi/process-report/get-driver-route`
77
77
  return traccar.axios.post(url, {
78
78
  from,
79
79
  to,
@@ -86,7 +86,7 @@ async function _getDriverRoute (traccar, from, to, slice, deviceCount, devices,
86
86
  if (--retry) {
87
87
  return _getDriverRoute(traccar, from, to, slice, deviceCount, devices, userData, retry)
88
88
  } else {
89
- console.error('giving up', url, slice[0].id, 'after 3 retries', e.message)
89
+ console.error('giving up', slice[0].id, 'after 3 retries', e.message)
90
90
  }
91
91
  })
92
92
  .then(r => (r && r.data) || [])
@@ -171,32 +171,7 @@ function processDevices (from, to, devices, data) {
171
171
  const devicesResult = []
172
172
 
173
173
  for (const d of devices) {
174
- const positions = data.route.filter(t => t.deviceId === d.id)
175
-
176
- const lighterPositions = positions.map(p => {
177
- return {
178
- id: p.id,
179
- fixTime: p.fixTime,
180
- address: p.address,
181
- speed: p.speed,
182
- latitude: p.latitude,
183
- longitude: p.longitude,
184
- attributes: {
185
- driverUniqueId: p.attributes.driverUniqueId,
186
- temp1: p.attributes.temp1,
187
- temp2: p.attributes.temp2,
188
- door1: p.attributes.door1,
189
- door2: p.attributes.door2,
190
- sensor: p.attributes.sensor,
191
- rain: p.attributes.rain,
192
- ignition: p.attributes.ignition,
193
- alarm: p.attributes.alarm,
194
- input: p.attributes.input,
195
- di2: p.attributes.di2,
196
- di3: p.attributes.di3
197
- }
198
- }
199
- })
174
+ const lighterPositions = data.route.filter(t => t.deviceId === d.id)
200
175
  if (lighterPositions.length > 0) {
201
176
  devicesResult.push({
202
177
  device: d,
package/src/util/utils.js CHANGED
@@ -16,9 +16,10 @@ exports.getTranslations = (userData) => {
16
16
  }
17
17
 
18
18
  exports.getLanguage = (userData) => {
19
+ const partner = getUserPartner(userData.user)
19
20
  return userData.user.attributes.lang ||
20
21
  ((typeof navigator !== 'undefined') && navigator.language) ||
21
- getUserPartner(userData.user).lang ||
22
+ (partner && partner.lang) ||
22
23
  'pt-BR'
23
24
  }
24
25