diff options
Diffstat (limited to 'lib/Travel/Status/DE/HAFAS/Journey.pm')
-rw-r--r-- | lib/Travel/Status/DE/HAFAS/Journey.pm | 11 |
1 files changed, 10 insertions, 1 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; |