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