diff options
| -rwxr-xr-x | lib/Travelynx.pm | 24 | ||||
| -rwxr-xr-x | lib/Travelynx/Controller/Traveling.pm | 15 |
2 files changed, 35 insertions, 4 deletions
diff --git a/lib/Travelynx.pm b/lib/Travelynx.pm index a83af39..89a0158 100755 --- a/lib/Travelynx.pm +++ b/lib/Travelynx.pm @@ -1461,16 +1461,25 @@ sub startup { arrival_eva => $new_checkout_station_id ); - # If in_transit already contains arrival data for another estimated - # destination, we must invalidate it. if ( defined $journey->{checkout_station_id} and $journey->{checkout_station_id} != $new_checkout_station_id ) { + # If in_transit already contains arrival data for another estimated + # destination, we must invalidate it. $self->in_transit->unset_arrival_data( uid => $uid, db => $db ); + + # The same applies to suggestions + $self->in_transit->update_data( + uid => $uid, + db => $db, + data => { + connection_suggestions_iris => [], + }, + ); } # Note that a train may pass the same station several times. @@ -1799,6 +1808,17 @@ sub startup { cancelled_destination => $found->[0], ); } + else { + # remove connection suggestions that may have been saved for a different target station + $self->in_transit->update_data( + uid => $uid, + db => $db, + data => { + connection_suggestions_dbris => [], + connection_suggestions_efa => [], + }, + ); + } if ($tx) { $tx->commit; diff --git a/lib/Travelynx/Controller/Traveling.pm b/lib/Travelynx/Controller/Traveling.pm index da889f0..0132a23 100755 --- a/lib/Travelynx/Controller/Traveling.pm +++ b/lib/Travelynx/Controller/Traveling.pm @@ -2205,8 +2205,19 @@ sub polyline_add_stops { } $route_i += 1; } - $route_i = 0; + $route_i = -1; for my $stop ( @{$route} ) { + $route_i += 1; + if ( $opt{partial} ) { + if ( $route_i == 0 ) { + $polyline->[0][2] = $stop->[1]; + next; + } + if ( $route_i == $#{$route} ) { + $polyline->[-1][2] = $stop->[1]; + next; + } + } my $key = $route_i . ';' . $stop->[1]; if ( $min_dist{$key} ) { if ( defined $polyline->[ $min_dist{$key}{index} ][2] ) { @@ -2232,7 +2243,6 @@ sub polyline_add_stops { $polyline->[ $min_dist{$key}{index} ][2] = $stop->[1]; } - $route_i += 1; } return; } @@ -2350,6 +2360,7 @@ sub set_polyline { my $err = $self->polyline_add_stops( polyline => \@polyline, route => \@route, + partial => ( $self->param('upload-partial') ? 1 : 0 ), ); if ($err) { |
