Skip to content
Snippets Groups Projects
Commit 653d3c74 authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

db-ris: Only show info column when a train is late

parent 1e036e94
No related branches found
No related tags found
No related merge requests found
git HEAD
[db-ris]
* Only display info when a train is late, not when on time / unknown
[Travel::Status::DE::DeutscheBahn]
* Proper HTTP request error handling
* Strip leading whitespace from ::Result info
Travel::Status::DE::DeutscheBahn 0.01 - Mon Jun 27 2011
......
......@@ -80,6 +80,16 @@ sub display_result {
return;
}
sub filter_info {
my ($info) = @_;
if ( $info =~ m{ ^ (?: p.nktlich | k [.] A [.] ) $ }ox ) {
return q{};
}
return $info;
}
sub filter_via {
my (@via) = @_;
......@@ -133,7 +143,7 @@ for my $d ( $status->results() ) {
[
$d->time, $d->train,
join( q{ }, filter_via(@via) ), $d->destination,
$d->platform, $d->info
$d->platform, filter_info( $d->info )
]
);
}
......
......@@ -135,7 +135,8 @@ sub results {
$str =~ tr/ //s;
}
$info =~ s/,Grund//;
$info =~ s{ ,Grund }{}ox;
$info =~ s{ ^ \s+ }{}ox;
while ( $route =~ m{$re_via}g ) {
if ($first) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment