diff options
author | Birte Kristina Friesel <derf@finalrewind.org> | 2024-08-10 17:34:48 +0200 |
---|---|---|
committer | Birte Kristina Friesel <derf@finalrewind.org> | 2024-08-10 17:34:48 +0200 |
commit | 84664d24e63baa6efa420f805e387d06d586dbb9 (patch) | |
tree | 279eb032e0cc53a79127c0d3f5015ce926dc3574 /lib/Travel/Status/DE/HAFAS/Stop.pm | |
parent | 563feae6991aaaa0bf3247d8e16ad5a078d7db7c (diff) |
Journey, Stop: handle BVG utilization data
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; |