summaryrefslogtreecommitdiff
path: root/lib/Travel/Status/DE
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Travel/Status/DE')
-rw-r--r--lib/Travel/Status/DE/HAFAS/Journey.pm11
-rw-r--r--lib/Travel/Status/DE/HAFAS/Stop.pm11
2 files changed, 20 insertions, 2 deletions
diff --git a/lib/Travel/Status/DE/HAFAS/Journey.pm b/lib/Travel/Status/DE/HAFAS/Journey.pm
index e02e45c..07325e5 100644
--- a/lib/Travel/Status/DE/HAFAS/Journey.pm
+++ b/lib/Travel/Status/DE/HAFAS/Journey.pm
@@ -221,7 +221,16 @@ sub new {
my %tco;
for my $tco_id ( @{ $journey->{stbStop}{dTrnCmpSX}{tcocX} // [] } ) {
my $tco_kv = $tcocL[$tco_id];
- $tco{ $tco_kv->{c} } = $tco_kv->{r};
+
+ # BVG has rRT (real-time?) and r (prognosed?); others only have r
+ my $load = $tco_kv->{rRT} // $tco_kv->{r};
+
+ # BVG uses 11 .. 13 rather than 1 .. 4
+ if ( $load > 10 ) {
+ $load -= 10;
+ }
+
+ $tco{ $tco_kv->{c} } = $load;
}
if (%tco) {
$ref->{load} = \%tco;
diff --git a/lib/Travel/Status/DE/HAFAS/Stop.pm b/lib/Travel/Status/DE/HAFAS/Stop.pm
index 98af9ed..75560de 100644
--- a/lib/Travel/Status/DE/HAFAS/Stop.pm
+++ b/lib/Travel/Status/DE/HAFAS/Stop.pm
@@ -135,7 +135,16 @@ sub new {
$ref->{load} = {};
for my $tco_id ( @{ $stop->{dTrnCmpSX}{tcocX} // [] } ) {
my $tco_kv = $common->{tcocL}[$tco_id];
- $ref->{load}{ $tco_kv->{c} } = $tco_kv->{r};
+
+ # BVG has rRT (real-time?) and r (prognosed?); others only have r
+ my $load = $tco_kv->{rRT} // $tco_kv->{r};
+
+ # BVG uses 11 .. 13 rather than 1 .. 4
+ if ( $load > 10 ) {
+ $load -= 10;
+ }
+
+ $ref->{load}{ $tco_kv->{c} } = $load;
}
return $ref;