fleetmap-reports 1.0.232 → 1.0.233

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.
@@ -0,0 +1,7 @@
1
+ <component name="ProjectCodeStyleConfiguration">
2
+ <code_scheme name="Project" version="173">
3
+ <ScalaCodeStyleSettings>
4
+ <option name="MULTILINE_STRING_CLOSING_QUOTES_ON_NEW_LINE" value="true" />
5
+ </ScalaCodeStyleSettings>
6
+ </code_scheme>
7
+ </component>
@@ -0,0 +1,5 @@
1
+ <component name="ProjectCodeStyleConfiguration">
2
+ <state>
3
+ <option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
4
+ </state>
5
+ </component>
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="JavaScriptLibraryMappings">
4
+ <file url="file://$PROJECT_DIR$" libraries="{Node.js Core}" />
5
+ </component>
6
+ </project>
package/lang/enGB.js CHANGED
@@ -214,7 +214,6 @@ module.exports = {
214
214
  duration: 'Duration',
215
215
  vehicles: 'Vehicles',
216
216
  vehicle: 'Vehicle',
217
- licensePlate: 'License Plate',
218
217
  odometer: 'Odometer',
219
218
  startOdometer: 'Start (Km)',
220
219
  endOdometer: 'End (Km)',
package/lang/ptBR.js CHANGED
@@ -203,7 +203,6 @@ module.exports = {
203
203
  duration: 'Duração',
204
204
  vehicles: 'Veículos',
205
205
  vehicle: 'Veículo',
206
- licensePlate: 'Placa',
207
206
  odometer: 'Conta-Quilómetros',
208
207
  startOdometer: 'Início (Km)',
209
208
  endOdometer: 'Fim (Km)',
package/lang/ptPT.js CHANGED
@@ -210,7 +210,6 @@ module.exports = {
210
210
  duration: 'Duração',
211
211
  vehicles: 'Veículos',
212
212
  vehicle: 'Veículo',
213
- licensePlate: 'Matrícula',
214
213
  odometer: 'Conta-Quilómetros',
215
214
  startOdometer: 'Início (Km)',
216
215
  endOdometer: 'Fim (Km)',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fleetmap-reports",
3
- "version": "1.0.232",
3
+ "version": "1.0.233",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
package/src/index.js CHANGED
@@ -23,7 +23,7 @@ function Reports(config, axios) {
23
23
  return require('./speeding-report').createSpeedingReport(from, to, userData, this.traccar, roadSpeedLimits)
24
24
  }
25
25
 
26
- this.speedingReportToPDF = async (userData, reportData) => {
26
+ this.speedingReportToPDF = (userData, reportData) => {
27
27
  return require('./speeding-report').exportSpeedingReportToPDF(userData, reportData)
28
28
  }
29
29
 
package/src/index.test.js CHANGED
@@ -3,42 +3,25 @@ const {SessionApi} = require("traccar-api");
3
3
  const axios = require('axios')
4
4
  const axiosCookieJarSupport = require('axios-cookiejar-support').default;
5
5
  const tough = require('tough-cookie');
6
- const style = require("./reportStyle");
7
6
  const cookieJar = new tough.CookieJar();
8
7
 
9
8
  axiosCookieJarSupport(axios)
10
9
 
11
-
12
- describe('test reports', function() {
13
- this.timeout(9000000)
14
- it('test queue', async () => {
15
- const traccarConfig = {
16
- basePath: 'https://api.fleetmap.io/api',
17
- baseOptions: {
18
- withCredentials: true,
19
- jar: cookieJar
20
- }
10
+ test('speedingReport', async () => {
11
+ const traccarConfig = {
12
+ basePath: 'https://api.pinme.io/api',
13
+ baseOptions: {
14
+ withCredentials: true,
15
+ jar: cookieJar
21
16
  }
17
+ }
22
18
 
23
- await new SessionApi(traccarConfig, null, axios).sessionPost('jppenas@gmail.com', 'penas46881')
24
- const report = new Index(traccarConfig, axios)
25
- const userData = await report.getUserData()
26
- userData.groupByDay = true
27
- const reportData = await report.kmsReport(new Date(2021, 10, 19, 0, 0, 0, 0),
28
- new Date(2021, 10, 21, 23, 59, 59, 0),
29
- userData)
30
-
31
- const reportResult = reportData[0]
32
- reportResult.devices.forEach(d => {
33
- console.log(d.device.name)
34
- d.days.forEach(day => {
35
- console.log(day.date + ' - ' + day.kms)
36
- })
37
- })
38
-
19
+ await new SessionApi(traccarConfig, null, axios).sessionPost('-','-')
20
+ const report = new Index(traccarConfig, axios)
21
+ const userData = await report.getUserData()
39
22
 
40
- const pdf = report.kmsReportToPDF(userData, reportResult)
23
+ await report.speedingReport(new Date(2021, 2, 30, 0, 0, 0, 0),
24
+ new Date(2021, 2, 30, 23, 59, 59, 0),
25
+ userData)
41
26
 
42
- console.log(pdf)
43
- })
44
- })
27
+ }, 10000)
package/src/kms-report.js CHANGED
@@ -156,7 +156,7 @@ async function exportKmsReportToPDF(userData, reportData) {
156
156
  const data = []
157
157
  d.days.forEach(day => {
158
158
  const temp = [
159
- day.date,
159
+ new Date(day.date).toLocaleDateString(),
160
160
  (day.kms/1000).toFixed(0)
161
161
  ]
162
162
 
@@ -240,7 +240,6 @@ function exportKmsReportToExcel(userData, reportData) {
240
240
  if(userData.groupByDay) {
241
241
  headers.push(
242
242
  {label: translations.report.vehicle, value: 'name'},
243
- {label: translations.report.licensePlate, value: 'licenseplate'},
244
243
  {label: translations.report.group, value: 'group'},
245
244
  {label: translations.report.date, value: 'date'},
246
245
  {label: translations.report.distance, value: 'distance'})
@@ -251,8 +250,8 @@ function exportKmsReportToExcel(userData, reportData) {
251
250
  {label: translations.report.distance, value: 'distance'})
252
251
  } else {
253
252
  headers.push(
254
- {label: translations.report.vehicle, value: 'name'},
255
- {label: translations.report.licensePlate, value: 'licenseplate'},
253
+ {label: translations.report.driver, value: 'name'},
254
+ {label: translations.settings.vehicle_licenseplate, value: 'licenseplate'},
256
255
  {label: translations.report.group, value: 'group'},
257
256
  {label: translations.report.distance, value: 'distance'})
258
257
  }
@@ -263,25 +262,25 @@ function exportKmsReportToExcel(userData, reportData) {
263
262
  const group = userData.byDriver ? userData.groups.find(g => g.drivers.includes(d.driver.id)) :
264
263
  userData.groups.find(g => d.device.groupId === g.id)
265
264
 
266
- if (userData.groupByDay) {
267
- data = data.concat([{}])
268
- data = data.concat(d.days.map(a => {
269
- return {
270
- name: d.device.name,
265
+ if (userData.groupByDay) {
266
+ data = data.concat([{}])
267
+ data = data.concat(d.days.map(a => {
268
+ return {
269
+ name: userData.byDriver ? d.driver.name : d.device.name,
270
+ group: group ? group.name : '',
271
+ licenseplate: d.device.attributes.license_plate,
272
+ date: a.date,
273
+ distance: Number((a.kms / 1000).toFixed(0))
274
+ }
275
+ }))
276
+ } else {
277
+ data = data.concat([{
278
+ name: userData.byDriver ? d.driver.name : d.summary.deviceName,
271
279
  group: group ? group.name : '',
272
280
  licenseplate: d.device.attributes.license_plate,
273
- date: a.date,
274
- distance: Number((a.kms / 1000).toFixed(0))
275
- }
276
- }))
277
- } else {
278
- data = data.concat([{
279
- name: userData.byDriver ? d.driver.name : d.summary.deviceName,
280
- group: group ? group.name : '',
281
- licenseplate: userData.byDriver ? '' : d.device.attributes.license_plate,
282
- distance: Number((d.summary.distance / 1000).toFixed(0))
283
- }])
284
- }
281
+ distance: Number((d.summary.distance / 1000).toFixed(0))
282
+ }])
283
+ }
285
284
  })
286
285
 
287
286
  return {
@@ -139,7 +139,7 @@ async function exportLocationReportToPDF(userData, reportData) {
139
139
  doc.text(new Date(d.from).toLocaleString() + ' - ' + new Date(d.to).toLocaleString(), 20, space + 25)
140
140
  d.positions.map(a => {
141
141
  const temp = [
142
- getLocationDate(a, userData.user),
142
+ a.fixTime,
143
143
  a.address,
144
144
  Math.round(a.speed * 1.85200),
145
145
  a.attributes.ignition ? translations.report.ignitionOn : translations.report.ignitionOff,
@@ -1,10 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="RunConfigurationProducerService">
4
- <option name="ignoredProducers">
5
- <set>
6
- <option value="com.android.tools.idea.compose.preview.runconfiguration.ComposePreviewRunConfigurationProducer" />
7
- </set>
8
- </option>
9
- </component>
10
- </project>
@@ -1,204 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="ChangeListManager">
4
- <list default="true" id="eb665c86-c893-4333-bd2a-721dc27980b9" name="Changes" comment="Kms report grouped by day">
5
- <change beforePath="$PROJECT_DIR$/lang/enGB.js" beforeDir="false" afterPath="$PROJECT_DIR$/lang/enGB.js" afterDir="false" />
6
- <change beforePath="$PROJECT_DIR$/lang/ptBR.js" beforeDir="false" afterPath="$PROJECT_DIR$/lang/ptBR.js" afterDir="false" />
7
- <change beforePath="$PROJECT_DIR$/lang/ptPT.js" beforeDir="false" afterPath="$PROJECT_DIR$/lang/ptPT.js" afterDir="false" />
8
- <change beforePath="$PROJECT_DIR$/package.json" beforeDir="false" afterPath="$PROJECT_DIR$/package.json" afterDir="false" />
9
- <change beforePath="$PROJECT_DIR$/src/index.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/index.js" afterDir="false" />
10
- <change beforePath="$PROJECT_DIR$/src/index.test.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/index.test.js" afterDir="false" />
11
- <change beforePath="$PROJECT_DIR$/src/kms-report.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/kms-report.js" afterDir="false" />
12
- </list>
13
- <option name="SHOW_DIALOG" value="false" />
14
- <option name="HIGHLIGHT_CONFLICTS" value="true" />
15
- <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
16
- <option name="LAST_RESOLUTION" value="IGNORE" />
17
- </component>
18
- <component name="Git.Settings">
19
- <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
20
- </component>
21
- <component name="ProjectId" id="20NIxbej0qfi8RaO3jr1XOU0xol" />
22
- <component name="ProjectViewState">
23
- <option name="hideEmptyMiddlePackages" value="true" />
24
- <option name="showLibraryContents" value="true" />
25
- </component>
26
- <component name="PropertiesComponent">
27
- <property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
28
- <property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
29
- <property name="WebServerToolWindowFactoryState" value="false" />
30
- <property name="last_opened_file_path" value="$PROJECT_DIR$" />
31
- <property name="nodejs.mocha.mocha_node_package_dir" value="$PROJECT_DIR$/node_modules/mocha" />
32
- <property name="nodejs_package_manager_path" value="npm" />
33
- <property name="ts.external.directory.path" value="$APPLICATION_HOME_DIR$/plugins/JavaScriptLanguage/jsLanguageServicesImpl/external" />
34
- <property name="vue.rearranger.settings.migration" value="true" />
35
- </component>
36
- <component name="RunManager" selected="Mocha.test reports">
37
- <configuration name="here" type="mocha-javascript-test-runner" temporary="true" nameIsGenerated="true">
38
- <node-interpreter>project</node-interpreter>
39
- <node-options />
40
- <mocha-package>$PROJECT_DIR$/node_modules/mocha</mocha-package>
41
- <working-directory>$PROJECT_DIR$</working-directory>
42
- <pass-parent-env>true</pass-parent-env>
43
- <ui>bdd</ui>
44
- <extra-mocha-options />
45
- <test-kind>SUITE</test-kind>
46
- <test-file>$PROJECT_DIR$/src/index.test.js</test-file>
47
- <test-names>
48
- <name value="here" />
49
- </test-names>
50
- <method v="2" />
51
- </configuration>
52
- <configuration name="report" type="mocha-javascript-test-runner" temporary="true" nameIsGenerated="true">
53
- <node-interpreter>project</node-interpreter>
54
- <node-options />
55
- <mocha-package>$PROJECT_DIR$/node_modules/mocha</mocha-package>
56
- <working-directory>$PROJECT_DIR$</working-directory>
57
- <pass-parent-env>true</pass-parent-env>
58
- <ui>bdd</ui>
59
- <extra-mocha-options />
60
- <test-kind>SUITE</test-kind>
61
- <test-file>$PROJECT_DIR$/src/index.test.js</test-file>
62
- <test-names>
63
- <name value="report" />
64
- </test-names>
65
- <method v="2" />
66
- </configuration>
67
- <configuration name="speedingReport" type="mocha-javascript-test-runner" temporary="true" nameIsGenerated="true">
68
- <node-interpreter>project</node-interpreter>
69
- <node-options />
70
- <mocha-package>$PROJECT_DIR$/node_modules/mocha</mocha-package>
71
- <working-directory>$PROJECT_DIR$</working-directory>
72
- <pass-parent-env>true</pass-parent-env>
73
- <ui>bdd</ui>
74
- <extra-mocha-options />
75
- <test-kind>TEST</test-kind>
76
- <test-file>$PROJECT_DIR$/src/index.test.js</test-file>
77
- <test-names>
78
- <name value="speedingReport" />
79
- </test-names>
80
- <method v="2" />
81
- </configuration>
82
- <configuration name="test reports" type="mocha-javascript-test-runner" temporary="true" nameIsGenerated="true">
83
- <node-interpreter>project</node-interpreter>
84
- <node-options />
85
- <mocha-package>$PROJECT_DIR$/node_modules/mocha</mocha-package>
86
- <working-directory>$PROJECT_DIR$</working-directory>
87
- <pass-parent-env>true</pass-parent-env>
88
- <ui>bdd</ui>
89
- <extra-mocha-options />
90
- <test-kind>SUITE</test-kind>
91
- <test-file>$PROJECT_DIR$/src/index.test.js</test-file>
92
- <test-names>
93
- <name value="test reports" />
94
- </test-names>
95
- <method v="2" />
96
- </configuration>
97
- <configuration name="test reports.test queue" type="mocha-javascript-test-runner" temporary="true" nameIsGenerated="true">
98
- <node-interpreter>project</node-interpreter>
99
- <node-options />
100
- <mocha-package>$PROJECT_DIR$/node_modules/mocha</mocha-package>
101
- <working-directory>$PROJECT_DIR$</working-directory>
102
- <pass-parent-env>true</pass-parent-env>
103
- <ui>bdd</ui>
104
- <extra-mocha-options />
105
- <test-kind>TEST</test-kind>
106
- <test-file>$PROJECT_DIR$/src/index.test.js</test-file>
107
- <test-names>
108
- <name value="test reports" />
109
- <name value="test queue" />
110
- </test-names>
111
- <method v="2" />
112
- </configuration>
113
- <recent_temporary>
114
- <list>
115
- <item itemvalue="Mocha.test reports" />
116
- <item itemvalue="Mocha.test reports.test queue" />
117
- <item itemvalue="Mocha.speedingReport" />
118
- <item itemvalue="Mocha.report" />
119
- <item itemvalue="Mocha.here" />
120
- </list>
121
- </recent_temporary>
122
- </component>
123
- <component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
124
- <component name="TaskManager">
125
- <task active="true" id="Default" summary="Default task">
126
- <changelist id="eb665c86-c893-4333-bd2a-721dc27980b9" name="Changes" comment="" />
127
- <created>1635878866368</created>
128
- <option name="number" value="Default" />
129
- <option name="presentableId" value="Default" />
130
- <updated>1635878866368</updated>
131
- <workItem from="1635878870054" duration="105000" />
132
- <workItem from="1635943211865" duration="371000" />
133
- <workItem from="1636030918716" duration="808000" />
134
- <workItem from="1636366400735" duration="3018000" />
135
- <workItem from="1636371409243" duration="45000" />
136
- <workItem from="1636371621773" duration="4750000" />
137
- <workItem from="1636623371114" duration="675000" />
138
- <workItem from="1636624396937" duration="1987000" />
139
- <workItem from="1636627666406" duration="1616000" />
140
- <workItem from="1636647112207" duration="1748000" />
141
- <workItem from="1636981640447" duration="4315000" />
142
- <workItem from="1637009407292" duration="1470000" />
143
- <workItem from="1637012863006" duration="5376000" />
144
- <workItem from="1637087797229" duration="5701000" />
145
- <workItem from="1637227826845" duration="1275000" />
146
- <workItem from="1637441942952" duration="4543000" />
147
- <workItem from="1637670815688" duration="2973000" />
148
- <workItem from="1637674107929" duration="13419000" />
149
- <workItem from="1637756665591" duration="3093000" />
150
- </task>
151
- <task id="LOCAL-00001" summary="Fix getStyle">
152
- <created>1636983717385</created>
153
- <option name="number" value="00001" />
154
- <option name="presentableId" value="LOCAL-00001" />
155
- <option name="project" value="LOCAL" />
156
- <updated>1636983717385</updated>
157
- </task>
158
- <task id="LOCAL-00002" summary="Fix getStyle in all reports">
159
- <created>1637020728356</created>
160
- <option name="number" value="00002" />
161
- <option name="presentableId" value="LOCAL-00002" />
162
- <option name="project" value="LOCAL" />
163
- <updated>1637020728356</updated>
164
- </task>
165
- <task id="LOCAL-00003" summary="try catch on pdf addImage">
166
- <created>1637247013210</created>
167
- <option name="number" value="00003" />
168
- <option name="presentableId" value="LOCAL-00003" />
169
- <option name="project" value="LOCAL" />
170
- <updated>1637247013211</updated>
171
- </task>
172
- <task id="LOCAL-00004" summary="Kms report grouped by day">
173
- <created>1637715473148</created>
174
- <option name="number" value="00004" />
175
- <option name="presentableId" value="LOCAL-00004" />
176
- <option name="project" value="LOCAL" />
177
- <updated>1637715473149</updated>
178
- </task>
179
- <option name="localTasksCounter" value="5" />
180
- <servers />
181
- </component>
182
- <component name="TypeScriptGeneratedFilesManager">
183
- <option name="version" value="3" />
184
- </component>
185
- <component name="Vcs.Log.Tabs.Properties">
186
- <option name="TAB_STATES">
187
- <map>
188
- <entry key="MAIN">
189
- <value>
190
- <State />
191
- </value>
192
- </entry>
193
- </map>
194
- </option>
195
- <option name="oldMeFiltersMigrated" value="true" />
196
- </component>
197
- <component name="VcsManagerConfiguration">
198
- <MESSAGE value="Fix getStyle" />
199
- <MESSAGE value="Fix getStyle in all reports" />
200
- <MESSAGE value="try catch on pdf addImage" />
201
- <MESSAGE value="Kms report grouped by day" />
202
- <option name="LAST_COMMIT_MESSAGE" value="Kms report grouped by day" />
203
- </component>
204
- </project>