From 611e5af908c48b2134c29b36dbd59b9e0940748d Mon Sep 17 00:00:00 2001 From: Birte Kristina Friesel Date: Thu, 26 Dec 2024 13:46:17 +0100 Subject: Location: Parse cancellations --- lib/Travel/Status/DE/DBRIS/Location.pm | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'lib/Travel/Status/DE/DBRIS/Location.pm') diff --git a/lib/Travel/Status/DE/DBRIS/Location.pm b/lib/Travel/Status/DE/DBRIS/Location.pm index 63b26ac..c397b60 100644 --- a/lib/Travel/Status/DE/DBRIS/Location.pm +++ b/lib/Travel/Status/DE/DBRIS/Location.pm @@ -50,6 +50,22 @@ sub new { = $opt{strptime_obj}->parse_datetime( $json->{ezAnkunftsZeitpunkt} ); } + for my $message ( @{ $json->{priorisierteMeldungen} // [] } ) { + if ( $message->{type} and $message->{type} eq 'HALT_AUSFALL' ) { + $ref->{is_cancelled} = 1; + } + push( @{ $ref->{messages} }, $message ); + } + + for my $message ( @{ $json->{risMeldungen} // [] } ) { + if ( $message->{key} + and $message->{key} eq 'text.realtime.stop.cancelled' ) + { + $ref->{is_cancelled} = 1; + } + $ref->{ris_messages}{ $message->{key} } = $message->{value}; + } + $ref->{arr} = $ref->{rt_arr} // $ref->{sched_arr}; $ref->{dep} = $ref->{rt_dep} // $ref->{sched_dep}; $ref->{platform} = $ref->{rt_platform} // $ref->{sched_platform}; -- cgit v1.2.3