Unverified Commit 35338125 authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

departure board: move get_connecting_trains call to controller

this is in preparation for turning it into a promise
parent e0b82469
Loading
Loading
Loading
Loading
+18 −7
Original line number Diff line number Diff line
@@ -622,10 +622,15 @@ sub station {
			  map { [ $_, $_->departure->epoch // $_->sched_departure->epoch ] }
			  @results;

			my @connecting_trains;
			if ($train) {
				@results
				  = grep { $_->type . ' ' . $_->train_no eq $train } @results;
			}
			else {
				@connecting_trains = $self->get_connecting_trains(
					eva => $status->{station_eva} );
			}

			$self->render(
				'departures',
@@ -633,12 +638,14 @@ sub station {
				results          => \@results,
				station          => $status->{station_name},
				related_stations => $status->{related_stations},
				connections      => \@connecting_trains,
				title            => "travelynx: $status->{station_name}",
			);
		}
	)->catch(
		sub {
			my ($status) = @_;
			if ( $status->{errstr} ) {
				$self->render(
					'landingpage',
					version => $self->app->config->{version} // 'UNKNOWN',
@@ -647,6 +654,10 @@ sub station {
					error             => $status->{errstr}
				);
			}
			else {
				$self->render( 'exception', exception => $status );
			}
		}
	)->wait;
	$self->users->mark_seen( uid => $self->current_user->{id} );
}
+1 −1
Original line number Diff line number Diff line
@@ -40,7 +40,7 @@
		</div>
	</div>
% }
% elsif (not param('train') and my @connections = get_connecting_trains(eva => $eva)) {
% elsif (not param('train') and my @connections = @{stash('connections') // []}) {
	% $have_connections = 1;
	<div class="row">
		<div class="col s12">