GPXIN-25: Multiple Track Support not Working



Issue Information

Issue Type: Bug
 
Priority: Major
Status: Closed

Reported By:
Ben Tasker
Assigned To:
Ben Tasker
Project: PHP GPXIngest (GPXIN)
Resolution: Fixed (2016-02-13 11:55:04)
Affects Version: 1.02,
Target version: 1.02,

Created: 2016-02-13 10:56:38
Time Spent Working
Estimated:
 
20 minutes
Remaining:
  
10 minutes
Logged:
  
10 minutes


Description
Reported in Github #5

i have file with many trk in one gpx-file...

but your script work only with LAST trk-section in xml...

you could introduce support for these files?

thanks


Attachments

20130518.gpx.zip

Issue Links

Github #5
Toggle State Changes

Activity


Nice catch - that's a bug.

The script is supposed to support multiple tracks, however, whilst it iterates over them it fails to increase the numeric key used for that track (or within the codebase - journey) and so essentially overwrites the previously processed tracks.

Variable is defined here - https://github.com/bentasker/PHP-GPX-Ingest/blob/master/GPXIngest.class.php#L232
Used here - https://github.com/bentasker/PHP-GPX-Ingest/blob/master/GPXIngest.class.php#L243

But never incremented
Attaching provided example GPX
btasker added '20130518.gpx.zip' to Attachments
btasker changed timespent from '0 minutes' to '5 minutes'
Have just committed a fix. It's possible it'll interfere with the overall file stats, though it doesn't read as though it should.

Should also look at renaming the variable to something more meaningful

Repo: PHP-GPX-Ingest
Commit: 51efb6a76bcfb48c48efec26a649029f333c90ea
Author: B Tasker <github@<Domain Hidden>>

Date: Sat Feb 13 10:59:39 2016 +0000
Commit Message: Fixed track counter. See GPXIN-25 and #5



Modified (-)(+)
-------
GPXIngest.class.php




Webhook User-Agent

GitHub-Hookshot/21f57ba


View Commit


Repo: PHP-GPX-Ingest
Commit: f8a5bd88efcb30fbd0f457de5ab284b213bfc133
Author: B Tasker <github@<Domain Hidden>>

Date: Sat Feb 13 11:02:37 2016 +0000
Commit Message: Renaming trackcounter variable to something more meaningful. See GPXIN-25



Modified (-)(+)
-------
GPXIngest.class.php




Webhook User-Agent

GitHub-Hookshot/21f57ba


View Commit


Repo: PHP-GPX-Ingest
Commit: 82df9205d80901bdba3554c92ca921f3de9cc4fa
Author: B Tasker <github@<Domain Hidden>>

Date: Sat Feb 13 11:48:51 2016 +0000
Commit Message: Correcting missed variable name change. See GPXIN-25



Modified (-)(+)
-------
GPXIngest.class.php




Webhook User-Agent

GitHub-Hookshot/21f57ba


View Commit

Commit f8a5bd8 had an error - I missed renaming one instance of a, so all journey names were being set to "journey" leading to the same behaviour as previously. Commit 82df920 fixes
~# cat test.php
<?php
include 'GPXIngest.class.php';
$gpx = new GPXIngest();
$gpx->loadFile('20130518.gpx');
$gpx->ingest();

print_r($gpx->getTrackIDs());
~# php test.php
Array
(
    [0] => journey0
    [1] => journey1
    [2] => journey2
    [3] => journey3
    [4] => journey4
    [5] => journey5
    [6] => journey6
    [7] => journey7
    [8] => journey8
    [9] => journey9
    [10] => journey10
    [11] => journey11
    [12] => journey12
    [13] => journey13
    [14] => journey14
    [15] => journey15
)
btasker changed timespent from '5 minutes' to '10 minutes'
User reports it's working as expected now. Closing as Fixed
btasker changed status from 'Open' to 'Resolved'
btasker added 'Fixed' to resolution
btasker changed status from 'Resolved' to 'Closed'

Work log


Ben Tasker
Permalink
2016-02-13 11:00:03

Time Spent: 5 minutes
Log Entry: Fixing

Ben Tasker
Permalink
2016-02-13 11:54:02

Time Spent: 5 minutes
Log Entry: Testing previous fix and correcting