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

readd ze zycles

parent 2ab551e9
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -312,8 +312,9 @@ sub startup {
	$r->get('/_ajax_mapinfo/:tripid/:lineno')->to('map#ajax_route');
	$r->get('/map/:tripid/:lineno')->to('map#route');
	$r->get('/intersection/:trips')->to('map#intersection');
	$r->get('/z/:train/*station')->to('stationboard#station_train_details');
	$r->get('/z/:train')->to('stationboard#train_details');
	$r->get( '/z/:train/*station' => 'train_at_station' )
	  ->to('stationboard#station_train_details');
	$r->get( '/z/:train' => 'train' )->to('stationboard#train_details');

	$r->get('/map')->to('map#search_form');
	$r->get('/_trainsearch')->to('map#search');
+24 −5
Original line number Diff line number Diff line
@@ -814,12 +814,12 @@ sub render_train {
		  = $self->app->train_details_db->{ $departure->{train_no} };
		my @cycle_from;
		my @cycle_to;
		for my $cycle ( values %{ $departure->{composition}->{cycle} // {} } ) {
			push( @cycle_from, @{ $cycle->{from} // [] } );
			push( @cycle_to,   @{ $cycle->{to}   // [] } );
		for my $pred ( @{ $departure->{composition}{predecessors} // [] } ) {
			push( @cycle_from, $pred->[1] );
		}
		for my $succ ( @{ $departure->{composition}{successors} // [] } ) {
			push( @cycle_to, $succ->[1] );
		}
		@cycle_from = sort { $a <=> $b } uniq @cycle_from;
		@cycle_to   = sort { $a <=> $b } uniq @cycle_to;
		$departure->{cycle_from}
		  = [ map { [ $_, $self->app->train_details_db->{$_} ] } @cycle_from ];
		$departure->{cycle_to}
@@ -1059,6 +1059,25 @@ sub train_details {
				$res->{details} = [@him_details];
			}

			if ( $self->param('detailed') ) {
				$res->{composition}
				  = $self->app->train_details_db->{ $res->{train_no} };
				my @cycle_from;
				my @cycle_to;
				for my $pred ( @{ $res->{composition}{predecessors} // [] } ) {
					push( @cycle_from, $pred->[1] );
				}
				for my $succ ( @{ $res->{composition}{successors} // [] } ) {
					push( @cycle_to, $succ->[1] );
				}
				$res->{cycle_from}
				  = [ map { [ $_, $self->app->train_details_db->{$_} ] }
					  @cycle_from ];
				$res->{cycle_to}
				  = [ map { [ $_, $self->app->train_details_db->{$_} ] }
					  @cycle_to ];
			}

			$self->render(
				$self->param('ajax') ? '_train_details' : 'train_details',
				departure => $res,
+11 −5
Original line number Diff line number Diff line
@@ -320,10 +320,6 @@
        </ul>
      </div>
%   }
%   if ($departure->{has_cycle}) {
      <div class="db-attr"><a href="https://lib.finalrewind.org/dbdb/db_umlauf/<%= $departure->{train_no} %>.svg">Umlaufplan</a>
        (ggf. fehlerhaft)</div>
%   }
%   if ($details->{attributes}) {
%     if (@{$details->{attributes}} > 1) {
        <div class="db-attr">
@@ -352,7 +348,12 @@
%           my ($train_no, $train) = @{$t};
%           my $tt = $train->{type} // $train->{rawType} // 'Zug';
%           $tt =~ s{ .*|[0-9]}{};
%           if ($tt ne 'Zug') {
            <li><a href="<%= url_for('train', train => "$tt $train_no")->query({detailed => param('detailed'), past => param('past'), rt => param('rt')}) %>"><%= $tt %> <%= $train_no %></a>
%           }
%           else {
            <li><%= $tt %> <%= $train_no %>
%           }
%             if ($train->{route}{start} and $train->{route}{end}) {
                <%= $train->{route}{start} %> → <%= $train->{route}{end} %>
%             }
@@ -361,7 +362,7 @@
        </ul>
%     }
%   }
%   elsif ($details and not $departure->{departure}) {
%   if ($details and not $departure->{departure}) {
%     if (my $e = $details->{route}{postEnd}) {
        Zug wird voraussichtlich in <%= $e %> abgestellt.<br/><br/>
%     }
@@ -372,7 +373,12 @@
%           my ($train_no, $train) = @{$t};
%           my $tt = $train->{type} // $train->{rawType} // 'Zug';
%           $tt =~ s{ .*|[0-9]}{};
%           if ($tt ne 'Zug') {
            <li><a href="<%= url_for('train', train => "$tt $train_no")->query({detailed => param('detailed'), past => param('past'), rt => param('rt')}) %>"><%= $tt %> <%= $train_no %></a>
%           }
%           else {
            <li><%= $tt %> <%= $train_no %>
%           }
%             if ($train->{route}{start} and $train->{route}{end}) {
                <%= $train->{route}{start} %> → <%= $train->{route}{end} %>
%             }