add support for HAFAS connection suggestions; drop manual destination list
Still TODO: handle stations that have several EVAs
This commit is contained in:
parent
8810acf742
commit
de074342de
14 changed files with 177 additions and 192 deletions
|
@ -1915,6 +1915,20 @@ my @migrations = (
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
# v49 -> v50
|
||||||
|
# travelynx 2.0 introduced proper HAFAS support, so there is no need for
|
||||||
|
# the 'FYI, here is some hAFAS data' kludge anymore.
|
||||||
|
sub {
|
||||||
|
my ($db) = @_;
|
||||||
|
$db->query(
|
||||||
|
qq{
|
||||||
|
drop view user_transit;
|
||||||
|
drop table localtransit;
|
||||||
|
update schema_version set version = 50;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
sub sync_stations {
|
sub sync_stations {
|
||||||
|
|
|
@ -800,10 +800,7 @@ sub insight {
|
||||||
my ($self) = @_;
|
my ($self) = @_;
|
||||||
|
|
||||||
my $user = $self->current_user;
|
my $user = $self->current_user;
|
||||||
my ( $use_history, $destinations ) = $self->users->use_history(
|
my $use_history = $self->users->use_history( uid => $user->{id} );
|
||||||
uid => $user->{id},
|
|
||||||
with_local_transit => 1
|
|
||||||
);
|
|
||||||
|
|
||||||
if ( $self->param('action') and $self->param('action') eq 'save' ) {
|
if ( $self->param('action') and $self->param('action') eq 'save' ) {
|
||||||
if ( $self->param('on_departure') ) {
|
if ( $self->param('on_departure') ) {
|
||||||
|
@ -820,22 +817,9 @@ sub insight {
|
||||||
$use_history &= ~0x02;
|
$use_history &= ~0x02;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $self->param('local_transit') ) {
|
|
||||||
$use_history |= 0x04;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$use_history &= ~0x04;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( $self->param('destinations') ) {
|
|
||||||
$destinations
|
|
||||||
= [ split( qr{\r?\n\r?}, $self->param('destinations') ) ];
|
|
||||||
}
|
|
||||||
|
|
||||||
$self->users->use_history(
|
$self->users->use_history(
|
||||||
uid => $user->{id},
|
uid => $user->{id},
|
||||||
set => $use_history,
|
set => $use_history
|
||||||
destinations => $destinations
|
|
||||||
);
|
);
|
||||||
$self->flash( success => 'use_history' );
|
$self->flash( success => 'use_history' );
|
||||||
$self->redirect_to('account');
|
$self->redirect_to('account');
|
||||||
|
@ -843,8 +827,6 @@ sub insight {
|
||||||
|
|
||||||
$self->param( on_departure => $use_history & 0x01 ? 1 : 0 );
|
$self->param( on_departure => $use_history & 0x01 ? 1 : 0 );
|
||||||
$self->param( on_arrival => $use_history & 0x02 ? 1 : 0 );
|
$self->param( on_arrival => $use_history & 0x02 ? 1 : 0 );
|
||||||
$self->param( local_transit => $use_history & 0x04 ? 1 : 0 );
|
|
||||||
$self->param( destinations => join( "\n", @{$destinations} ) );
|
|
||||||
$self->render('use_history');
|
$self->render('use_history');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,10 +28,7 @@ sub get_connecting_trains_p {
|
||||||
my ( $self, %opt ) = @_;
|
my ( $self, %opt ) = @_;
|
||||||
|
|
||||||
my $uid = $opt{uid} //= $self->current_user->{id};
|
my $uid = $opt{uid} //= $self->current_user->{id};
|
||||||
my ( $use_history, $lt_stops ) = $self->users->use_history(
|
my $use_history = $self->users->use_history( uid => $uid );
|
||||||
uid => $uid,
|
|
||||||
with_local_transit => 1
|
|
||||||
);
|
|
||||||
|
|
||||||
my ( $eva, $exclude_via, $exclude_train_id, $exclude_before );
|
my ( $eva, $exclude_via, $exclude_train_id, $exclude_before );
|
||||||
my $now = $self->now->epoch;
|
my $now = $self->now->epoch;
|
||||||
|
@ -68,13 +65,14 @@ sub get_connecting_trains_p {
|
||||||
return $promise->reject;
|
return $promise->reject;
|
||||||
}
|
}
|
||||||
|
|
||||||
my @destinations = $self->journeys->get_connection_targets(%opt);
|
my @destinations
|
||||||
|
= uniq_by { $_->{name} } $self->journeys->get_connection_targets(%opt);
|
||||||
|
|
||||||
if ($exclude_via) {
|
if ($exclude_via) {
|
||||||
@destinations = grep { $_ ne $exclude_via } @destinations;
|
@destinations = grep { $_->{name} ne $exclude_via } @destinations;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( not( @destinations or $use_history & 0x04 and @{$lt_stops} ) ) {
|
if ( not @destinations ) {
|
||||||
return $promise->reject;
|
return $promise->reject;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,8 +81,11 @@ sub get_connecting_trains_p {
|
||||||
= $can_check_in ? 40 : ( ( ${arr_countdown} // 0 ) / 60 + 40 );
|
= $can_check_in ? 40 : ( ( ${arr_countdown} // 0 ) / 60 + 40 );
|
||||||
|
|
||||||
my $iris_promise = Mojo::Promise->new;
|
my $iris_promise = Mojo::Promise->new;
|
||||||
|
my %via_count = map { $_->{name} => 0 } @destinations;
|
||||||
|
|
||||||
if (@destinations) {
|
if ( $eva >= 8000000
|
||||||
|
and List::Util::any { $_->{eva} >= 8000000 } @destinations )
|
||||||
|
{
|
||||||
$self->iris->get_departures_p(
|
$self->iris->get_departures_p(
|
||||||
station => $eva,
|
station => $eva,
|
||||||
lookbehind => 10,
|
lookbehind => 10,
|
||||||
|
@ -94,7 +95,7 @@ sub get_connecting_trains_p {
|
||||||
sub {
|
sub {
|
||||||
my ($stationboard) = @_;
|
my ($stationboard) = @_;
|
||||||
if ( $stationboard->{errstr} ) {
|
if ( $stationboard->{errstr} ) {
|
||||||
$iris_promise->reject( $stationboard->{errstr} );
|
$iris_promise->resolve( [] );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,7 +106,6 @@ sub get_connecting_trains_p {
|
||||||
my @results;
|
my @results;
|
||||||
my @cancellations;
|
my @cancellations;
|
||||||
my $excluded_train;
|
my $excluded_train;
|
||||||
my %via_count = map { $_ => 0 } @destinations;
|
|
||||||
for my $train ( @{ $stationboard->{results} } ) {
|
for my $train ( @{ $stationboard->{results} } ) {
|
||||||
if ( not $train->departure ) {
|
if ( not $train->departure ) {
|
||||||
next;
|
next;
|
||||||
|
@ -144,7 +144,7 @@ sub get_connecting_trains_p {
|
||||||
$train->sched_route_post, $train->sched_route_end
|
$train->sched_route_post, $train->sched_route_end
|
||||||
);
|
);
|
||||||
for my $dest (@destinations) {
|
for my $dest (@destinations) {
|
||||||
if ( has_str_in_list( $dest, @via ) ) {
|
if ( has_str_in_list( $dest->{name}, @via ) ) {
|
||||||
push( @cancellations, [ $train, $dest ] );
|
push( @cancellations, [ $train, $dest ] );
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
|
@ -153,8 +153,8 @@ sub get_connecting_trains_p {
|
||||||
else {
|
else {
|
||||||
my @via = ( $train->route_post, $train->route_end );
|
my @via = ( $train->route_post, $train->route_end );
|
||||||
for my $dest (@destinations) {
|
for my $dest (@destinations) {
|
||||||
if ( $via_count{$dest} < 2
|
if ( $via_count{ $dest->{name} } < 2
|
||||||
and has_str_in_list( $dest, @via ) )
|
and has_str_in_list( $dest->{name}, @via ) )
|
||||||
{
|
{
|
||||||
push( @results, [ $train, $dest ] );
|
push( @results, [ $train, $dest ] );
|
||||||
|
|
||||||
|
@ -162,7 +162,7 @@ sub get_connecting_trains_p {
|
||||||
if ( not $train->departure
|
if ( not $train->departure
|
||||||
or $train->departure->epoch >= $now )
|
or $train->departure->epoch >= $now )
|
||||||
{
|
{
|
||||||
$via_count{$dest}++;
|
$via_count{ $dest->{name} }++;
|
||||||
}
|
}
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
|
@ -234,7 +234,7 @@ sub get_connecting_trains_p {
|
||||||
}
|
}
|
||||||
)->catch(
|
)->catch(
|
||||||
sub {
|
sub {
|
||||||
$iris_promise->reject(@_);
|
$iris_promise->resolve( [] );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
)->wait;
|
)->wait;
|
||||||
|
@ -267,8 +267,8 @@ sub get_connecting_trains_p {
|
||||||
sub {
|
sub {
|
||||||
my ( $iris, $hafas ) = @_;
|
my ( $iris, $hafas ) = @_;
|
||||||
my @iris_trains = @{ $iris->[0] };
|
my @iris_trains = @{ $iris->[0] };
|
||||||
my @hafas_trains = @{ $hafas->[0] };
|
my @all_hafas_trains = @{ $hafas->[0] };
|
||||||
my @transit_fyi;
|
my @hafas_trains;
|
||||||
|
|
||||||
# We've already got a list of connecting trains; this function
|
# We've already got a list of connecting trains; this function
|
||||||
# only adds further information to them. We ignore errors, as
|
# only adds further information to them. We ignore errors, as
|
||||||
|
@ -278,11 +278,12 @@ sub get_connecting_trains_p {
|
||||||
if ( $iris_train->[0]->departure_is_cancelled ) {
|
if ( $iris_train->[0]->departure_is_cancelled ) {
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
for my $hafas_train (@hafas_trains) {
|
for my $hafas_train (@all_hafas_trains) {
|
||||||
if ( $hafas_train->number
|
if ( $hafas_train->number
|
||||||
and $hafas_train->number
|
and $hafas_train->number
|
||||||
== $iris_train->[0]->train_no )
|
== $iris_train->[0]->train_no )
|
||||||
{
|
{
|
||||||
|
$hafas_train->{iris_seen} = 1;
|
||||||
if ( $hafas_train->load
|
if ( $hafas_train->load
|
||||||
and $hafas_train->load->{SECOND} )
|
and $hafas_train->load->{SECOND} )
|
||||||
{
|
{
|
||||||
|
@ -290,7 +291,8 @@ sub get_connecting_trains_p {
|
||||||
}
|
}
|
||||||
for my $stop ( $hafas_train->route ) {
|
for my $stop ( $hafas_train->route ) {
|
||||||
if ( $stop->{name}
|
if ( $stop->{name}
|
||||||
and $stop->{name} eq $iris_train->[1]
|
and $stop->{name} eq
|
||||||
|
$iris_train->[1]->{name}
|
||||||
and $stop->{arr} )
|
and $stop->{arr} )
|
||||||
{
|
{
|
||||||
$iris_train->[2] = $stop->{arr};
|
$iris_train->[2] = $stop->{arr};
|
||||||
|
@ -308,14 +310,15 @@ sub get_connecting_trains_p {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( $use_history & 0x04 and @{$lt_stops} ) {
|
for my $hafas_train (@all_hafas_trains) {
|
||||||
my %via_count = map { $_ => 0 } @{$lt_stops};
|
if ( $hafas_train->{iris_seen} ) {
|
||||||
for my $hafas_train (@hafas_trains) {
|
next;
|
||||||
|
}
|
||||||
for my $stop ( $hafas_train->route ) {
|
for my $stop ( $hafas_train->route ) {
|
||||||
for my $dest ( @{$lt_stops} ) {
|
for my $dest (@destinations) {
|
||||||
if ( $stop->{name}
|
if ( $stop->{name}
|
||||||
and $stop->{name} eq $dest
|
and $stop->{name} eq $dest->{name}
|
||||||
and $via_count{$dest} < 2
|
and $via_count{ $dest->{name} } < 2
|
||||||
and $hafas_train->datetime )
|
and $hafas_train->datetime )
|
||||||
{
|
{
|
||||||
my $departure = $hafas_train->datetime;
|
my $departure = $hafas_train->datetime;
|
||||||
|
@ -326,21 +329,10 @@ sub get_connecting_trains_p {
|
||||||
{
|
{
|
||||||
$arrival->add( minutes => $delay );
|
$arrival->add( minutes => $delay );
|
||||||
}
|
}
|
||||||
if ( $departure->epoch >= $exclude_before )
|
if ( $departure->epoch >= $exclude_before ) {
|
||||||
{
|
$via_count{ $dest->{name} }++;
|
||||||
$via_count{$dest}++;
|
push( @hafas_trains,
|
||||||
push(
|
[ $hafas_train, $dest, $arrival ] );
|
||||||
@transit_fyi,
|
|
||||||
[
|
|
||||||
{
|
|
||||||
line => $hafas_train->line,
|
|
||||||
departure => $departure,
|
|
||||||
departure_delay => $delay
|
|
||||||
},
|
|
||||||
$dest, $arrival
|
|
||||||
]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -353,14 +345,12 @@ sub get_connecting_trains_p {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$promise->resolve( \@iris_trains, \@transit_fyi );
|
$promise->resolve( \@iris_trains, \@hafas_trains );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
)->catch(
|
)->catch(
|
||||||
sub {
|
sub {
|
||||||
my ($err) = @_;
|
my ($err) = @_;
|
||||||
|
|
||||||
# TODO logging. HAFAS errors should never happen, IRIS errors are noteworthy too.
|
|
||||||
$promise->reject($err);
|
$promise->reject($err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -401,13 +391,13 @@ sub homepage {
|
||||||
$self->render_later;
|
$self->render_later;
|
||||||
$self->get_connecting_trains_p->then(
|
$self->get_connecting_trains_p->then(
|
||||||
sub {
|
sub {
|
||||||
my ( $connecting_trains, $transit_fyi ) = @_;
|
my ( $connections_iris, $connections_hafas ) = @_;
|
||||||
$self->render(
|
$self->render(
|
||||||
'landingpage',
|
'landingpage',
|
||||||
user_status => $status,
|
user_status => $status,
|
||||||
journey_visibility => $journey_visibility,
|
journey_visibility => $journey_visibility,
|
||||||
connections => $connecting_trains,
|
connections_iris => $connections_iris,
|
||||||
transit_fyi => $transit_fyi,
|
connections_hafas => $connections_hafas,
|
||||||
);
|
);
|
||||||
$self->users->mark_seen( uid => $uid );
|
$self->users->mark_seen( uid => $uid );
|
||||||
}
|
}
|
||||||
|
@ -474,13 +464,13 @@ sub status_card {
|
||||||
$self->render_later;
|
$self->render_later;
|
||||||
$self->get_connecting_trains_p->then(
|
$self->get_connecting_trains_p->then(
|
||||||
sub {
|
sub {
|
||||||
my ( $connecting_trains, $transit_fyi ) = @_;
|
my ( $connections_iris, $connections_hafas ) = @_;
|
||||||
$self->render(
|
$self->render(
|
||||||
'_checked_in',
|
'_checked_in',
|
||||||
journey => $status,
|
journey => $status,
|
||||||
journey_visibility => $journey_visibility,
|
journey_visibility => $journey_visibility,
|
||||||
connections => $connecting_trains,
|
connections_iris => $connections_iris,
|
||||||
transit_fyi => $transit_fyi
|
connections_hafas => $connections_hafas,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
)->catch(
|
)->catch(
|
||||||
|
@ -511,7 +501,7 @@ sub status_card {
|
||||||
$self->render(
|
$self->render(
|
||||||
'_cancelled_departure',
|
'_cancelled_departure',
|
||||||
journey => $status->{cancellation},
|
journey => $status->{cancellation},
|
||||||
connections => $connecting_trains
|
connections_iris => $connecting_trains
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
)->catch(
|
)->catch(
|
||||||
|
@ -529,11 +519,12 @@ sub status_card {
|
||||||
$self->render_later;
|
$self->render_later;
|
||||||
$self->get_connecting_trains_p->then(
|
$self->get_connecting_trains_p->then(
|
||||||
sub {
|
sub {
|
||||||
my ($connecting_trains) = @_;
|
my ( $connections_iris, $connections_hafas ) = @_;
|
||||||
$self->render(
|
$self->render(
|
||||||
'_checked_out',
|
'_checked_out',
|
||||||
journey => $status,
|
journey => $status,
|
||||||
connections => $connecting_trains
|
connections_iris => $connections_iris,
|
||||||
|
connections_hafas => $connections_hafas,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
)->catch(
|
)->catch(
|
||||||
|
@ -1028,7 +1019,7 @@ sub station {
|
||||||
if ($connections_p) {
|
if ($connections_p) {
|
||||||
$connections_p->then(
|
$connections_p->then(
|
||||||
sub {
|
sub {
|
||||||
my ($connecting_trains) = @_;
|
my ( $connections_iris, $connections_hafas ) = @_;
|
||||||
$self->render(
|
$self->render(
|
||||||
'departures',
|
'departures',
|
||||||
eva => $status->{station_eva},
|
eva => $status->{station_eva},
|
||||||
|
@ -1038,7 +1029,8 @@ sub station {
|
||||||
related_stations => $status->{related_stations},
|
related_stations => $status->{related_stations},
|
||||||
user_status => $user_status,
|
user_status => $user_status,
|
||||||
can_check_out => $can_check_out,
|
can_check_out => $can_check_out,
|
||||||
connections => $connecting_trains,
|
connections_iris => $connections_iris,
|
||||||
|
connections_hafas => $connections_hafas,
|
||||||
api_link => $api_link,
|
api_link => $api_link,
|
||||||
title => "travelynx: $status->{station_name}",
|
title => "travelynx: $status->{station_name}",
|
||||||
);
|
);
|
||||||
|
|
|
@ -1726,7 +1726,7 @@ sub get_connection_targets {
|
||||||
my $min_count = $opt{min_count} // 3;
|
my $min_count = $opt{min_count} // 3;
|
||||||
|
|
||||||
if ( $opt{destination_name} ) {
|
if ( $opt{destination_name} ) {
|
||||||
return ( $opt{destination_name} );
|
return ( { eva => $opt{eva}, name => $opt{destination_name} } );
|
||||||
}
|
}
|
||||||
|
|
||||||
my $dest_id = $opt{eva} // $self->get_latest_dest_id(%opt);
|
my $dest_id = $opt{eva} // $self->get_latest_dest_id(%opt);
|
||||||
|
@ -1755,7 +1755,6 @@ sub get_connection_targets {
|
||||||
= $res->hashes->grep( sub { shift->{count} >= $min_count } )
|
= $res->hashes->grep( sub { shift->{count} >= $min_count } )
|
||||||
->map( sub { shift->{dest} } )->each;
|
->map( sub { shift->{dest} } )->each;
|
||||||
@destinations = $self->{stations}->get_by_evas(@destinations);
|
@destinations = $self->{stations}->get_by_evas(@destinations);
|
||||||
@destinations = map { $_->{name} } @destinations;
|
|
||||||
return @destinations;
|
return @destinations;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -567,7 +567,6 @@ sub delete {
|
||||||
$res{transit} = $db->delete( 'in_transit', { user_id => $uid } );
|
$res{transit} = $db->delete( 'in_transit', { user_id => $uid } );
|
||||||
$res{hooks} = $db->delete( 'webhooks', { user_id => $uid } );
|
$res{hooks} = $db->delete( 'webhooks', { user_id => $uid } );
|
||||||
$res{trwl} = $db->delete( 'traewelling', { user_id => $uid } );
|
$res{trwl} = $db->delete( 'traewelling', { user_id => $uid } );
|
||||||
$res{lt} = $db->delete( 'localtransit', { user_id => $uid } );
|
|
||||||
$res{password} = $db->delete( 'pending_passwords', { user_id => $uid } );
|
$res{password} = $db->delete( 'pending_passwords', { user_id => $uid } );
|
||||||
$res{relations} = $db->delete( 'relations',
|
$res{relations} = $db->delete( 'relations',
|
||||||
[ { subject_id => $uid }, { object_id => $uid } ] );
|
[ { subject_id => $uid }, { object_id => $uid } ] );
|
||||||
|
@ -651,36 +650,14 @@ sub use_history {
|
||||||
my $uid = $opt{uid};
|
my $uid = $opt{uid};
|
||||||
my $value = $opt{set};
|
my $value = $opt{set};
|
||||||
|
|
||||||
if ( $opt{destinations} ) {
|
|
||||||
$db->insert(
|
|
||||||
'localtransit',
|
|
||||||
{
|
|
||||||
user_id => $uid,
|
|
||||||
data =>
|
|
||||||
JSON->new->encode( { destinations => $opt{destinations} } )
|
|
||||||
},
|
|
||||||
{ on_conflict => \'(user_id) do update set data = EXCLUDED.data' }
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($value) {
|
if ($value) {
|
||||||
$db->update( 'users', { use_history => $value }, { id => $uid } );
|
$db->update( 'users', { use_history => $value }, { id => $uid } );
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
if ( $opt{with_local_transit} ) {
|
|
||||||
my $res = $db->select(
|
|
||||||
'user_transit',
|
|
||||||
[ 'use_history', 'data' ],
|
|
||||||
{ id => $uid }
|
|
||||||
)->expand->hash;
|
|
||||||
return ( $res->{use_history}, $res->{data}{destinations} // [] );
|
|
||||||
}
|
|
||||||
else {
|
else {
|
||||||
return $db->select( 'users', ['use_history'], { id => $uid } )
|
return $db->select( 'users', ['use_history'], { id => $uid } )
|
||||||
->hash->{use_history};
|
->hash->{use_history};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
sub use_external_services {
|
sub use_external_services {
|
||||||
my ( $self, %opt ) = @_;
|
my ( $self, %opt ) = @_;
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
in <a href="/s/<%= $journey->{dep_eva} %>"><%= $journey->{dep_name} %></a>
|
in <a href="/s/<%= $journey->{dep_eva} %>"><%= $journey->{dep_name} %></a>
|
||||||
entfällt. Der Zugausfall auf der Fahrt nach <%= $journey->{arr_name} %> wurde bereits dokumentiert.
|
entfällt. Der Zugausfall auf der Fahrt nach <%= $journey->{arr_name} %> wurde bereits dokumentiert.
|
||||||
</p>
|
</p>
|
||||||
% if (my @connections = @{stash('connections') // []}) {
|
% if (my @connections = @{stash('connections_iris') // []}) {
|
||||||
<p>Alternative Reisemöglichkeiten:</p>
|
<p>Alternative Reisemöglichkeiten:</p>
|
||||||
%= include '_connections', connections => \@connections, checkin_from => $journey->{dep_eva};
|
%= include '_connections', connections => \@connections, checkin_from => $journey->{dep_eva};
|
||||||
% }
|
% }
|
||||||
|
|
|
@ -199,19 +199,17 @@
|
||||||
</ul>
|
</ul>
|
||||||
</p>
|
</p>
|
||||||
% }
|
% }
|
||||||
% if (my @connections = @{stash('connections') // []}) {
|
% if (@{stash('connections_iris') // [] } or @{stash('connections_hafas') // []}) {
|
||||||
<span class="card-title" style="margin-top: 2ex;">Verbindungen</span>
|
<span class="card-title" style="margin-top: 2ex;">Verbindungen</span>
|
||||||
% if ($journey->{arrival_countdown} < 0) {
|
% if ($journey->{arrival_countdown} < 0) {
|
||||||
<p>Fahrt auswählen zum Einchecken mit Zielwahl.</p>
|
<p>Fahrt auswählen zum Einchecken mit Zielwahl.</p>
|
||||||
% }
|
% }
|
||||||
%= include '_connections', connections => \@connections, checkin_from => $journey->{arrival_countdown} < 0 ? $journey->{arr_eva} : undef;
|
% if (@{stash('connections_iris') // [] }) {
|
||||||
|
%= include '_connections', connections => stash('connections_iris'), checkin_from => $journey->{arrival_countdown} < 0 ? $journey->{arr_eva} : undef;
|
||||||
% }
|
% }
|
||||||
% if (my @transit_fyi = @{stash('transit_fyi') // []}) {
|
% if (@{stash('connections_hafas') // [] }) {
|
||||||
<span class="card-title" style="margin-top: 2ex;">Nahverkehr</span>
|
%= include '_connections_hafas', connections => stash('connections_hafas'), checkin_from => $journey->{arrival_countdown} < 0 ? $journey->{arr_eva} : undef;
|
||||||
% if ($journey->{arrival_countdown} < 0) {
|
|
||||||
<p>Nur zur Information – kein Checkin möglich.</p>
|
|
||||||
% }
|
% }
|
||||||
%= include '_transit_fyi', transit_fyi => \@transit_fyi;
|
|
||||||
% }
|
% }
|
||||||
% if (defined $journey->{arrival_countdown} and $journey->{arrival_countdown} <= 0) {
|
% if (defined $journey->{arrival_countdown} and $journey->{arrival_countdown} <= 0) {
|
||||||
<p style="margin-top: 2ex;">
|
<p style="margin-top: 2ex;">
|
||||||
|
|
|
@ -3,10 +3,15 @@
|
||||||
<span class="card-title">Ausgecheckt</span>
|
<span class="card-title">Ausgecheckt</span>
|
||||||
<p>Aus <%= $journey->{train_type} %> <%= $journey->{train_no} %>
|
<p>Aus <%= $journey->{train_type} %> <%= $journey->{train_no} %>
|
||||||
bis <a href="/s/<%= $journey->{arr_eva} %>?hafas=<%= $journey->{train_id} =~ m{[|]} ? 1 : 0 %>"><%= $journey->{arr_name} %></a></p>
|
bis <a href="/s/<%= $journey->{arr_eva} %>?hafas=<%= $journey->{train_id} =~ m{[|]} ? 1 : 0 %>"><%= $journey->{arr_name} %></a></p>
|
||||||
% if (my @connections = @{stash('connections') // []}) {
|
% if (@{stash('connections_iris') // [] } or @{stash('connections_hafas') // []}) {
|
||||||
<span class="card-title" style="margin-top: 2ex;">Verbindungen</span>
|
<span class="card-title" style="margin-top: 2ex;">Verbindungen</span>
|
||||||
<p>Zug auswählen zum Einchecken mit Zielwahl.</p>
|
<p>Fahrt auswählen zum Einchecken mit Zielwahl.</p>
|
||||||
%= include '_connections', connections => \@connections, checkin_from => $journey->{arr_eva};
|
% if (@{stash('connections_iris') // [] }) {
|
||||||
|
%= include '_connections', connections => stash('connections_iris'), checkin_from => $journey->{arr_eva};
|
||||||
|
% }
|
||||||
|
% if (@{stash('connections_hafas') // [] }) {
|
||||||
|
%= include '_connections_hafas', connections => stash('connections_hafas'), checkin_from => $journey->{arr_eva};
|
||||||
|
% }
|
||||||
% }
|
% }
|
||||||
</div>
|
</div>
|
||||||
<div class="card-action">
|
<div class="card-action">
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
% $link_class = 'action-cancelled-from';
|
% $link_class = 'action-cancelled-from';
|
||||||
% }
|
% }
|
||||||
% if ($checkin_from) {
|
% if ($checkin_from) {
|
||||||
<tr class="<%= $link_class %>" data-station="<%= $train->station_uic %>" data-train="<%= $train->train_id %>" data-dest="<%= $via %>">
|
<tr class="<%= $link_class %>" data-station="<%= $train->station_uic %>" data-train="<%= $train->train_id %>" data-dest="<%= $via->{name} %>">
|
||||||
% }
|
% }
|
||||||
% else {
|
% else {
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -33,10 +33,10 @@
|
||||||
</td>
|
</td>
|
||||||
<td class="<%= $td_class %>">
|
<td class="<%= $td_class %>">
|
||||||
% if ($checkin_from) {
|
% if ($checkin_from) {
|
||||||
<a><%= $via %></a>
|
<a><%= $via->{name} %></a>
|
||||||
% }
|
% }
|
||||||
% else {
|
% else {
|
||||||
%= $via
|
%= $via->{name}
|
||||||
% }
|
% }
|
||||||
<br/>
|
<br/>
|
||||||
% if ($load) {
|
% if ($load) {
|
||||||
|
|
59
templates/_connections_hafas.html.ep
Normal file
59
templates/_connections_hafas.html.ep
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
<div><table class="striped"><tbody>
|
||||||
|
% for my $res (@{$connections}) {
|
||||||
|
% my ($train, $via, $via_arr) = @{$res};
|
||||||
|
% $via_arr = $via_arr ? $via_arr->strftime('%H:%M') : q{};
|
||||||
|
% my $td_class = '';
|
||||||
|
% my $link_class = 'action-checkin';
|
||||||
|
% if ($train->is_cancelled) {
|
||||||
|
% $td_class = 'cancelled';
|
||||||
|
% $link_class = 'action-cancelled-from';
|
||||||
|
% }
|
||||||
|
% if ($checkin_from) {
|
||||||
|
<tr class="<%= $link_class %>" data-station="<%= $train->station_eva %>" data-train="<%= $train->id %>" data-dest="<%= $via->{name} %>">
|
||||||
|
% }
|
||||||
|
% else {
|
||||||
|
<tr>
|
||||||
|
% }
|
||||||
|
<td class="<%= $td_class %>">
|
||||||
|
% if ($train->platform) {
|
||||||
|
% if ($checkin_from) {
|
||||||
|
<a>Gleis <%= $train->platform %></a>
|
||||||
|
% }
|
||||||
|
% else {
|
||||||
|
Gleis <%= $train->platform %>
|
||||||
|
% }
|
||||||
|
<br/>
|
||||||
|
% }
|
||||||
|
% if ($checkin_from) {
|
||||||
|
<a><%= $train->line %></a>
|
||||||
|
% }
|
||||||
|
% else {
|
||||||
|
%= $train->line
|
||||||
|
% }
|
||||||
|
</td>
|
||||||
|
<td class="<%= $td_class %>">
|
||||||
|
% if ($checkin_from) {
|
||||||
|
<a><%= $via->{name} %></a>
|
||||||
|
% }
|
||||||
|
% else {
|
||||||
|
%= $via->{name}
|
||||||
|
% }
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
% if ($train->is_cancelled) {
|
||||||
|
%= $train->sched_datetime->strftime('%H:%M')
|
||||||
|
⊖
|
||||||
|
% }
|
||||||
|
% else {
|
||||||
|
%= $train->datetime->strftime('%H:%M')
|
||||||
|
% }
|
||||||
|
% if ($via_arr) {
|
||||||
|
→ <%= $via_arr %>
|
||||||
|
% }
|
||||||
|
% if ($train->delay) {
|
||||||
|
%= sprintf('(%+d)', $train->delay)
|
||||||
|
% }
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
% }
|
||||||
|
</tbody></table></div>
|
|
@ -1,22 +0,0 @@
|
||||||
<table class="striped"><tbody>
|
|
||||||
% for my $res (@{$transit_fyi}) {
|
|
||||||
% my ($info, $via, $via_arr) = @{$res};
|
|
||||||
% $via_arr = $via_arr ? $via_arr->strftime('%H:%M') : q{};
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
%= $info->{line}
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
%= $via
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
%= $info->{departure}->strftime('%H:%M')
|
|
||||||
→
|
|
||||||
%= $via_arr
|
|
||||||
% if ($info->{departure_delay}) {
|
|
||||||
%= sprintf('(%+d)', $info->{departure_delay})
|
|
||||||
% }
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
% }
|
|
||||||
</tbody></table>
|
|
|
@ -67,7 +67,7 @@
|
||||||
<th scope="row">Verbindungen</th>
|
<th scope="row">Verbindungen</th>
|
||||||
<td>
|
<td>
|
||||||
<a href="/account/insight"><i class="material-icons">edit</i></a>
|
<a href="/account/insight"><i class="material-icons">edit</i></a>
|
||||||
% if ($use_history & 0x07) {
|
% if ($use_history & 0x03) {
|
||||||
Vorschläge aktiv
|
Vorschläge aktiv
|
||||||
% }
|
% }
|
||||||
% else {
|
% else {
|
||||||
|
|
|
@ -72,12 +72,17 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
% }
|
% }
|
||||||
% elsif (not param('train') and my @connections = @{stash('connections') // []}) {
|
% elsif (not param('train') and (@{stash('connections_iris') // []} or @{stash('connections_hafas') // []}) ) {
|
||||||
% $have_connections = 1;
|
% $have_connections = 1;
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col s12">
|
<div class="col s12">
|
||||||
<p>Häufig genutzte Verbindungen – Fahrt auswählen zum Einchecken mit Zielwahl</p>
|
<p>Häufig genutzte Verbindungen – Fahrt auswählen zum Einchecken mit Zielwahl</p>
|
||||||
%= include '_connections', connections => \@connections, checkin_from => $eva;
|
% if (@{stash('connections_iris') // []}) {
|
||||||
|
%= include '_connections', connections => stash('connections_iris'), checkin_from => $eva;
|
||||||
|
% }
|
||||||
|
% if (@{stash('connections_hafas') // []}) {
|
||||||
|
%= include '_connections_hafas', connections => stash('connections_hafas'), checkin_from => $eva;
|
||||||
|
% }
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
% }
|
% }
|
||||||
|
|
|
@ -47,30 +47,6 @@
|
||||||
ohne Umweg über die Abfahrtstafel möglich.
|
ohne Umweg über die Abfahrtstafel möglich.
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
|
||||||
<div class="input-field col s12">
|
|
||||||
<label>
|
|
||||||
%= check_box local_transit => 1
|
|
||||||
<span>Nahverkehr</span>
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col s12">
|
|
||||||
Zeige beim Reisestatus zusätzlich Anschlussmöglichkeiten an den
|
|
||||||
Nahverkehr. Diese dienen lediglich zur Information; ein Checkin ist
|
|
||||||
nicht möglich. Es werden nur Anschlussmöglichkeiten zu Zielen
|
|
||||||
angezeigt, die im folgenden Feld gelistet sind (ein Ziel pro
|
|
||||||
Zeile, z.B. „Eichlinghofen H-Bahn, Dortmund“). Falls travelynx in
|
|
||||||
Zukunft eine Möglichkeit für Checkins in Nahverkehrsmittel erhält,
|
|
||||||
wird diese Liste ggf. gelöscht.
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col s12">
|
|
||||||
%= text_area 'destinations', id => 'destinations', class => 'materialize-textarea'
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col s3 m3 l3">
|
<div class="col s3 m3 l3">
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue