Loading lib/Travelynx.pm +31 −8 Original line number Diff line number Diff line Loading @@ -2364,6 +2364,7 @@ sub startup { my @route = @{ $in_transit->{route} // [] }; my @route_after; my $dep_info; my $stop_before_dest; my $is_after = 0; for my $station (@route) { Loading @@ -2379,6 +2380,11 @@ sub startup { } if ( $station->[0] eq $in_transit->{dep_name} ) { $is_after = 1; $self->app->log->debug("is_after"); if ( @{$station} > 1 ) { $self->app->log->debug("set dep_info"); $dep_info = $station->[1]; } } } my $stop_after_dep = $route_after[0][0]; Loading @@ -2396,6 +2402,7 @@ sub startup { train_line => $in_transit->{train_line}, train_no => $in_transit->{train_no}, train_id => $in_transit->{train_id}, boarding_countdown => -1, sched_departure => epoch_to_dt( $in_transit->{sched_dep_ts} ), real_departure => epoch_to_dt( $in_transit->{real_dep_ts} ), Loading Loading @@ -2426,6 +2433,22 @@ sub startup { } $ret->{extra_data}{qos_msg} = [@parsed_messages]; if ( $dep_info and $dep_info->{sched_arr} ) { $self->app->log->debug( "dep_info has sched_arr. set countdown."); $dep_info->{sched_arr} = epoch_to_dt( $dep_info->{sched_arr} ); $dep_info->{rt_arr} = $dep_info->{sched_arr}->clone; if ( $dep_info->{adelay} and $dep_info->{adelay} =~ m{^\d+$} ) { $dep_info->{rt_arr} ->add( minutes => $dep_info->{adelay} ); } $dep_info->{rt_arr_countdown} = $ret->{boarding_countdown} = $dep_info->{rt_arr}->epoch - $epoch; } for my $station (@route_after) { if ( @{$station} > 1 ) { my $times = $station->[1]; Loading templates/_checked_in.html.ep +9 −0 Original line number Diff line number Diff line Loading @@ -6,6 +6,15 @@ <div class="center-align countdown" data-duration="<%= $journey->{journey_duration} // 0 %>" data-arrival="<%= $journey->{real_arrival}->epoch %>"> % if ($journey->{boarding_countdown} > 120) { Einfahrt in <%= sprintf('%.f', $journey->{boarding_countdown} / 60) %> Minuten<br/> % } % elsif ($journey->{boarding_countdown} > 60) { Einfahrt in einer Minute<br/> % } % elsif ($journey->{boarding_countdown} > 0) { Zug fährt ein<br/> % } % if ($journey->{departure_countdown} > 120) { Abfahrt in <%= sprintf('%.f', $journey->{departure_countdown} / 60) %> Minuten % } Loading Loading
lib/Travelynx.pm +31 −8 Original line number Diff line number Diff line Loading @@ -2364,6 +2364,7 @@ sub startup { my @route = @{ $in_transit->{route} // [] }; my @route_after; my $dep_info; my $stop_before_dest; my $is_after = 0; for my $station (@route) { Loading @@ -2379,6 +2380,11 @@ sub startup { } if ( $station->[0] eq $in_transit->{dep_name} ) { $is_after = 1; $self->app->log->debug("is_after"); if ( @{$station} > 1 ) { $self->app->log->debug("set dep_info"); $dep_info = $station->[1]; } } } my $stop_after_dep = $route_after[0][0]; Loading @@ -2396,6 +2402,7 @@ sub startup { train_line => $in_transit->{train_line}, train_no => $in_transit->{train_no}, train_id => $in_transit->{train_id}, boarding_countdown => -1, sched_departure => epoch_to_dt( $in_transit->{sched_dep_ts} ), real_departure => epoch_to_dt( $in_transit->{real_dep_ts} ), Loading Loading @@ -2426,6 +2433,22 @@ sub startup { } $ret->{extra_data}{qos_msg} = [@parsed_messages]; if ( $dep_info and $dep_info->{sched_arr} ) { $self->app->log->debug( "dep_info has sched_arr. set countdown."); $dep_info->{sched_arr} = epoch_to_dt( $dep_info->{sched_arr} ); $dep_info->{rt_arr} = $dep_info->{sched_arr}->clone; if ( $dep_info->{adelay} and $dep_info->{adelay} =~ m{^\d+$} ) { $dep_info->{rt_arr} ->add( minutes => $dep_info->{adelay} ); } $dep_info->{rt_arr_countdown} = $ret->{boarding_countdown} = $dep_info->{rt_arr}->epoch - $epoch; } for my $station (@route_after) { if ( @{$station} > 1 ) { my $times = $station->[1]; Loading
templates/_checked_in.html.ep +9 −0 Original line number Diff line number Diff line Loading @@ -6,6 +6,15 @@ <div class="center-align countdown" data-duration="<%= $journey->{journey_duration} // 0 %>" data-arrival="<%= $journey->{real_arrival}->epoch %>"> % if ($journey->{boarding_countdown} > 120) { Einfahrt in <%= sprintf('%.f', $journey->{boarding_countdown} / 60) %> Minuten<br/> % } % elsif ($journey->{boarding_countdown} > 60) { Einfahrt in einer Minute<br/> % } % elsif ($journey->{boarding_countdown} > 0) { Zug fährt ein<br/> % } % if ($journey->{departure_countdown} > 120) { Abfahrt in <%= sprintf('%.f', $journey->{departure_countdown} / 60) %> Minuten % } Loading