Travel export is missing some of the (aggregated) sections of the Travels
Originally reported on picateam
Export travels doesn't export correctly all the sections of the travels.
- Step to reproduce: import the travelsTemplate.csv travelsTemplate.csv
- Export the file, its content is:
name type mode amount position no.person purpose round.trip geodesic.distance.km corrected.distance.km distance.km cumulative.distance.km emission.kg.co2e uncertainty.kg.co2e emission.withcontrails.kg.co2e uncertainty.withcontrails.kg.co2e cumulative.emission.kg.co2e cumulative.uncertainty.kg.co2e cumulative.emission.withcontrails.kg.co2e cumulative.uncertainty.withcontrails.kg.co2e
1 NA busintercity 1 engineer 1 conference true 77.95622496795087 116.93433745192631 233.86867490385262 233.86867490385262 7.15638145205789 4.293828871234734 7.15638145205789 4.293828871234734 7.15638145205789 4.293828871234734 7.15638145205789 4.293828871234734
2 NA car 1 engineer 4 conference true 210.91145866911955 274.1848962698554 137.0924481349277 137.0924481349277 29.557131817890415 17.734279090734248 29.557131817890415 17.734279090734248 29.557131817890415 17.734279090734248 29.557131817890415 17.734279090734248
3 NA cab 1 researcher 2 seminar false 80.67419976013144 104.87645968817088 157.31468953225632 157.31468953225632 33.91704706315446 20.35022823789267633.91704706315446 20.350228237892676 33.91704706315446 20.350228237892676 33.91704706315446 20.350228237892676
4 NA train 1 researcher 1 collaboration false 314.89405994147825 377.8728719297739 377.8728719297739 377.8728719297739 1.2469804773682538 0.24939609547365077 1.2469804773682538 0.24939609547365077 1.2469804773682538 0.24939609547365077 1.2469804773682538 0.24939609547365077
5 MX plane 1 student 1 teaching true 1328.6481756848182 1423.6481756848182 2847.2963513696363 2847.2963513696363 292.41733528566164 29.241733528566165533.8680658818068 373.70764611726474 292.41733528566164 29.241733528566165 533.8680658818068 373.70764611726474
6 NA train 1 engineer 1 visit false 110.88507660384035 133.0620919246084 133.0620919246084 133.0620919246084 2.3951176546429513 1.43707059278577082.3951176546429513 1.4370705927857708 2.3951176546429513 1.4370705927857708 2.3951176546429513 1.4370705927857708
7 IN train 1 engineer 1 visit false 360.695320608492 432.8343847301904 432.8343847301904 432.8343847301904 16.014872235017044 9.608923341010227 16.014872235017044 9.608923341010227 16.014872235017044 9.608923341010227 16.014872235017044 9.608923341010227
8 MX train 1 researcher 1 research.management false 367.474300851029 440.9691610212348 440.9691610212348 440.9691610212348 7.0555065763397575 4.233303945803854 7.0555065763397575 4.233303945803854 7.0555065763397575 4.233303945803854 7.0555065763397575 4.233303945803854
9 MX plane 1 researcher 1 teaching false 707.6630904642298 802.6630904642298 802.6630904642298 802.6630904642298 113.65709360973494 11.365709360973495 207.5686751940498 145.29807263583484 113.65709360973494 11.365709360973495 207.5686751940498 145.29807263583484
10 IN plane 1 researcher 1 teaching false 2620.797096317504 2715.797096317504 2715.797096317504 2715.797096317504 278.91236179180765 27.891236179180765 509.211955559532 356.4483688916724 278.91236179180765 27.891236179180765 509.211955559532 356.4483688916724
11 IN plane 1 researcher 1 teaching false 3532.298109049438 3627.298109049438 3627.298109049438 3627.298109049438 302.1539324838182 30.215393248381822 551.3493125755145 385.94451880286016 302.1539324838182 30.215393248381822 551.3493125755145 385.94451880286016
12 MX plane 1 student 1 teaching false 4785.358712619902 4880.358712619902 4880.358712619902 4880.358712619902 406.5338807612378 40.65338807612378 741.814524318225 519.2701670227575 406.5338807612378 40.65338807612378 741.814524318225 519.2701670227575
13 IN plane 1 student 1 teaching true 6311.040951740989 6406.040951740989 12812.081903481978 12812.081903481978 1067.2464225600488 106.724642256004881947.4364493292605 1363.2055145304823 1067.2464225600488 106.72464225600488 1947.4364493292605 1363.2055145304823
14 IN plane 1 student 1 teaching true 7679.218208021766 7774.218208021766 15548.436416043533 15548.436416043533 1295.1847534564263 129.518475345642632363.362335238617 1654.3536346670319 1295.1847534564263 129.51847534564263 2363.362335238617 1654.3536346670319
15 MX plane 1 guest 1 seminar true 8683.178230086754 8778.178230086754 17556.35646017351 17556.35646017351 1462.4444931324533 146.24444931324533 2668.5661819463735 1867.9963273624612 1462.4444931324533 146.24444931324533 2668.5661819463735 1867.9963273624612
16 MX plane 1 student 1 teaching true 9687.860804420288 9782.860804420288 19565.721608840577 19565.721608840577 1629.82461001642 162.982461001642 2973.9896845437675 2081.792779180637 1629.82461001642 162.982461001642 2973.9896845437675 2081.792779180637
17 IN plane 1 student 1 teaching true 10168.744366299476 10263.744366299476 20527.48873259895 20527.48873259895 1709.9398114254925 170.993981142549273120.1782873550405 2184.124801148528 1709.9398114254925 170.99398114254927 3120.1782873550405 2184.124801148528
18 MX plane 1 guest 1 seminar true 19061.922736075598 19156.922736075598 38313.845472151195 38313.845472151195 3191.5433278301944 319.15433278301947 5823.704511766981 4076.5931582368867 3191.5433278301944 319.15433278301947 5823.704511766981 4076.5931582368867
19 IN plane 1 guest 1 seminar true 16376.907397593073 16471.907397593073 32943.81479518615 32943.81479518615 2744.219772439006 274.42197724390064 5007.459848868294 3505.2218942078057 2744.219772439006 274.42197724390064 5007.459848868294 3505.2218942078057
20 IN ferry 1 researcher 1 teaching true 1566.4698994567818 1566.4698994567818 3132.9397989135637 3132.9397989135637 3067.148063136379 1840.2888378818272 3067.148063136379 1840.2888378818272 3067.148063136379 1840.2888378818272 3067.148063136379 1840.28883788182
We got 20 sections instead of 37 (unique) sections (when accounting with round-trips and amount)
Hints:
This code seems to export a single line per travels (regardless the number of section)
Todo
-
Add some tests in Travel.test.js
-
Fix the implementation (introducing travel.toString
or something that calls thesection.toString
(without the travel parameter) would be better designed.
Edited by Matt