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

-Of etc: show delays

parent 2114f509
Loading
Loading
Loading
Loading
+16 −4
Original line number Diff line number Diff line
@@ -297,17 +297,29 @@ sub display_result {
sub show_stopseq {
	my $trip = $efa->result;

	printf( "%s %s → %s\n",
		$trip->line, $trip->number // q{},
		$trip->dest_name );
	printf( "%s %s → %s\n", $trip->type, $trip->line // q{}, $trip->dest_name );

	printf(
		"Fahrt %s am %s\n",
		$trip->number || $stopseq,
		( $trip->route )[0]->sched_dep->strftime('%d.%m.%Y'),
	);
	say q{};

	my $delay_len = 0;
	my $max_delay = max map { abs( $_->delay // 0 ) } $trip->route;
	if ($max_delay) {
		$delay_len = length( sprintf( '%+d', $max_delay ) ) + 1;
	}

	for my $stop ( $trip->route ) {
		printf(
			"%s → %s  %s (%s) %s\n",
			"%s → %s%${delay_len}s  %s (%s) %s\n",
			$stop->arr ? $stop->arr->strftime('%H:%M')
			: q{     },
			$stop->dep ? $stop->dep->strftime('%H:%M')
			: q{     },
			$stop->delay ? sprintf( ' %+d', $stop->delay ) : q{},
			$stop->full_name,
			$stop->niveau,
			$stop->platform