From b12b5a821b68b98aad646f1931c6c9775759952c Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sun, 14 Jul 2019 21:29:52 +0200 Subject: Show departures of all linked stations Not well-tested yet, deployment will have to wait a bit. Issue #15 --- lib/Travelynx.pm | 14 ++++++++------ lib/Travelynx/Controller/Traveling.pm | 2 +- templates/_connections.html.ep | 8 ++++---- templates/departures.html.ep | 4 ++-- 4 files changed, 15 insertions(+), 13 deletions(-) diff --git a/lib/Travelynx.pm b/lib/Travelynx.pm index c502b8c..3ef7011 100755 --- a/lib/Travelynx.pm +++ b/lib/Travelynx.pm @@ -218,10 +218,11 @@ sub startup { $self->helper( 'get_departures' => sub { - my ( $self, $station, $lookbehind, $lookahead ) = @_; + my ( $self, $station, $lookbehind, $lookahead, $with_related ) = @_; - $lookbehind //= 180; - $lookahead //= 30; + $lookbehind //= 180; + $lookahead //= 30; + $with_related //= 0; my @station_matches = Travel::Status::DE::IRIS::Stations::get_station($station); @@ -240,6 +241,7 @@ sub startup { timeout => 10, agent => 'travelynx/' . $self->app->config->{version}, }, + with_related => $with_related, ); return { results => [ $status->results ], @@ -348,7 +350,7 @@ sub startup { 'checkin' => sub { my ( $self, $station, $train_id ) = @_; - my $status = $self->get_departures( $station, 140, 40 ); + my $status = $self->get_departures( $station, 140, 40, 0 ); if ( $status->{errstr} ) { return ( undef, $status->{errstr} ); } @@ -532,7 +534,7 @@ sub startup { my ( $self, $station, $force, $uid ) = @_; my $db = $self->pg->db; - my $status = $self->get_departures( $station, 120, 120 ); + my $status = $self->get_departures( $station, 120, 120, 0 ); $uid //= $self->current_user->{id}; my $user = $self->get_user_status($uid); my $train_id = $user->{train_id}; @@ -2060,7 +2062,7 @@ sub startup { return; } - my $stationboard = $self->get_departures( $ds100, 0, 40 ); + my $stationboard = $self->get_departures( $ds100, 0, 40, 1 ); if ( $stationboard->{errstr} ) { return; } diff --git a/lib/Travelynx/Controller/Traveling.pm b/lib/Travelynx/Controller/Traveling.pm index 59991a8..ca29594 100755 --- a/lib/Travelynx/Controller/Traveling.pm +++ b/lib/Travelynx/Controller/Traveling.pm @@ -338,7 +338,7 @@ sub station { my $station = $self->stash('station'); my $train = $self->param('train'); - my $status = $self->get_departures( $station, 120, 30 ); + my $status = $self->get_departures( $station, 120, 30, 1 ); if ( $status->{errstr} ) { $self->render( diff --git a/templates/_connections.html.ep b/templates/_connections.html.ep index cd9edc3..f1d8c2b 100644 --- a/templates/_connections.html.ep +++ b/templates/_connections.html.ep @@ -4,7 +4,7 @@ % if ($checkin_from) { - <%= $train->line %> + <%= $train->line %> % } % else { %= $train->line @@ -12,7 +12,7 @@ % if ($checkin_from) { - <%= $via %> + <%= $via %> % } % else { %= $via @@ -38,7 +38,7 @@ % if ($checkin_from) { - <%= $train->line %> + <%= $train->line %> % } % else { %= $train->line @@ -46,7 +46,7 @@ % if ($checkin_from) { - <%= $via %> + <%= $via %> % } % else { %= $via diff --git a/templates/departures.html.ep b/templates/departures.html.ep index 7e98d9c..9ab4340 100644 --- a/templates/departures.html.ep +++ b/templates/departures.html.ep @@ -64,12 +64,12 @@ % } - + <%= $result->line %> - + <%= $result->destination %> -- cgit v1.2.3