Skip to content

Commit

Permalink
Journey->add: store lat/lon for route at entry time, if available
Browse files Browse the repository at this point in the history
  • Loading branch information
derf committed Jul 21, 2024
1 parent 7b1a4fc commit de55368
Showing 1 changed file with 33 additions and 4 deletions.
37 changes: 33 additions & 4 deletions lib/Travelynx/Model/Journeys.pm
Original file line number Diff line number Diff line change
Expand Up @@ -167,16 +167,35 @@ sub add {
my @route;

if ( not $route_has_start ) {
push( @route, [ $dep_station->{name}, $dep_station->{eva}, {} ] );
push(
@route,
[
$dep_station->{name},
$dep_station->{eva},
{
lat => $dep_station->{lat},
lon => $dep_station->{lon},
}
]
);
}

if ( $opt{route} ) {
my @unknown_stations;
for my $station ( @{ $opt{route} } ) {
my $station_info = $self->{stations}->search($station);
if ($station_info) {
push( @route,
[ $station_info->{name}, $station_info->{eva}, {} ] );
push(
@route,
[
$station_info->{name},
$station_info->{eva},
{
lat => $station_info->{lat},
lon => $station_info->{lon},
}
]
);
}
else {
push( @route, [ $station, undef, {} ] );
Expand All @@ -198,7 +217,17 @@ sub add {
}

if ( not $route_has_stop ) {
push( @route, [ $arr_station->{name}, $arr_station->{eva}, {} ] );
push(
@route,
[
$arr_station->{name},
$arr_station->{eva},
{
lat => $arr_station->{lat},
lon => $arr_station->{lon},
}
]
);
}

my $entry = {
Expand Down

0 comments on commit de55368

Please sign in to comment.