summaryrefslogtreecommitdiff
path: root/lib/Travel/Status
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2015-04-18 23:03:15 +0200
committerDaniel Friesel <derf@finalrewind.org>2015-04-18 23:03:15 +0200
commitd629ad663f6195287dd31f0204f9d3a163b0869c (patch)
tree0812c04d38ede3d9e56a8bab7a774947946069e1 /lib/Travel/Status
parentef40feb961f363029d98524b62a38a977823bb2b (diff)
wing_id only uses two thirds of the train_id. now wing detection actually works.
Diffstat (limited to 'lib/Travel/Status')
-rw-r--r--lib/Travel/Status/DE/IRIS.pm3
-rw-r--r--lib/Travel/Status/DE/IRIS/Result.pm4
2 files changed, 4 insertions, 3 deletions
diff --git a/lib/Travel/Status/DE/IRIS.pm b/lib/Travel/Status/DE/IRIS.pm
index da39a7c..34f7fc4 100644
--- a/lib/Travel/Status/DE/IRIS.pm
+++ b/lib/Travel/Status/DE/IRIS.pm
@@ -13,7 +13,6 @@ use DateTime;
use Encode qw(encode decode);
use List::Util qw(first);
use LWP::UserAgent;
-use Scalar::Util qw(weaken);
use Travel::Status::DE::IRIS::Result;
use XML::LibXML;
@@ -298,7 +297,7 @@ sub get_realtime {
sub get_result_by_id {
my ( $self, $id ) = @_;
- my $res = first { $_->{raw_id} eq $id } $self->results;
+ my $res = first { $_->wing_id eq $id } @{ $self->{results} };
return $res;
}
diff --git a/lib/Travel/Status/DE/IRIS/Result.pm b/lib/Travel/Status/DE/IRIS/Result.pm
index e49750f..9b09c00 100644
--- a/lib/Travel/Status/DE/IRIS/Result.pm
+++ b/lib/Travel/Status/DE/IRIS/Result.pm
@@ -13,6 +13,7 @@ use DateTime;
use DateTime::Format::Strptime;
use List::Compare;
use List::MoreUtils qw(none uniq firstval);
+use Scalar::Util qw(weaken);
our $VERSION = '0.08';
@@ -98,7 +99,7 @@ Travel::Status::DE::IRIS::Result->mk_ro_accessors(
line_no train_no_transfer old_train_id old_train_no platform raw_id
realtime_xml route_start route_end sched_arrival sched_departure
sched_platform sched_route_start sched_route_end start stop_no time
- train_id train_no transfer type unknown_t unknown_o)
+ train_id train_no transfer type unknown_t unknown_o wing_id)
);
sub new {
@@ -113,6 +114,7 @@ sub new {
my ( $train_id, $start_ts, $stop_no ) = split( /.\K-/, $opt{raw_id} );
+ $ref->{wing_id} = "${train_id}-${start_ts}";
$train_id =~ s{^-}{};
$ref->{start} = $strp->parse_datetime($start_ts);