Skip to content

Commit

Permalink
do SORT_BY_TIMESTAMP only for tracks with timestamps (#52)
Browse files Browse the repository at this point in the history
Co-authored-by: Jens Hassler <j.hassler@iwf.ch>
  • Loading branch information
lukey78 and Jens Hassler authored Feb 28, 2021
1 parent b6b3a81 commit a0185f4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/phpGPX/Models/Route.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function getPoints()

$points = array_merge($points, $this->points);

if (phpGPX::$SORT_BY_TIMESTAMP && !empty($points)) {
if (phpGPX::$SORT_BY_TIMESTAMP && !empty($points) && $points[0]->time !== null) {
usort($points, array('phpGPX\Helpers\DateTimeHelper', 'comparePointsByTimestamp'));
}

Expand Down
2 changes: 1 addition & 1 deletion src/phpGPX/Models/Track.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function getPoints()
$points = array_merge($points, $segment->points);
}

if (phpGPX::$SORT_BY_TIMESTAMP && !empty($points)) {
if (phpGPX::$SORT_BY_TIMESTAMP && !empty($points) && $points[0]->time !== null) {
usort($points, array('phpGPX\Helpers\DateTimeHelper', 'comparePointsByTimestamp'));
}

Expand Down

0 comments on commit a0185f4

Please sign in to comment.