Commit be687b25 authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

fix hide_low_delay in most cases

parent 03814b1e
Loading
Loading
Loading
Loading
+10 −11
Original line number Diff line number Diff line
@@ -426,10 +426,9 @@ sub handle_request {
			elsif ( $result->delay and $result->delay > 0 ) {
				if ( $template eq 'clean' ) {
					$info = $delaymsg;
					$delay = $result->delay;
				}
				else {
					$info = sprintf( 'Verspätung ca. %d Min.%s%s',
					$info = sprintf( 'ca. +%d%s%s',
						$result->delay, $delaymsg ? q{: } : q{}, $delaymsg );
				}
			}
@@ -514,15 +513,14 @@ sub handle_request {
			}
		}

		if (    $template eq 'clean'
			and $info
			and $info =~ s{ (?: ca [.] \s* )? [+] (\d+) :? \s* }{}x )
		{
			$delay = $1;
		}
		if ( $hide_low_delay and $info ) {
		if ($hide_low_delay) {
			if ($info) {
				$info =~ s{ (?: ca [.] \s* )? [+] [ 1 2 3 4 ] $ }{}x;
			}
			if ( $delay and $delay < 5 ) {
				$delay = undef;
			}
		}
		if ($info) {
			$info =~ s{ (?: ca [.] \s* )? [+] (\d+) }{Verspätung ca $1 Min.}x;
		}
@@ -762,6 +760,7 @@ sub handle_request {
			title            => "departures for ${station}",
			refresh_interval => $refresh_interval + 3,
			hide_opts        => $hide_opts,
			hide_low_delay   => $hide_low_delay,
			show_realtime    => $show_realtime,
		);
	}