diff options
author | Birte Kristina Friesel <derf@finalrewind.org> | 2025-07-05 19:05:31 +0200 |
---|---|---|
committer | Birte Kristina Friesel <derf@finalrewind.org> | 2025-07-05 19:05:31 +0200 |
commit | 52d6ad8ffff67a04c18a730d4bb7612b060ef787 (patch) | |
tree | 6301f94ab979686f8a87c793d5761a394d68e27b | |
parent | 57378c55e4fb70a6ca789d1c3cbfb879b306dd27 (diff) |
Traveling: perltidy
-rwxr-xr-x | lib/Travelynx/Controller/Traveling.pm | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/lib/Travelynx/Controller/Traveling.pm b/lib/Travelynx/Controller/Traveling.pm index 7cd1e36..575e0e1 100755 --- a/lib/Travelynx/Controller/Traveling.pm +++ b/lib/Travelynx/Controller/Traveling.pm @@ -1750,16 +1750,14 @@ sub map_history { time_zone => 'Europe/Berlin' ); - if ( $filter_from ) - { + if ($filter_from) { $filter_from = $parser->parse_datetime($filter_from); } else { $filter_from = undef; } - if ( $filter_until ) - { + if ($filter_until) { $filter_until = $parser->parse_datetime($filter_until)->set( hour => 23, minute => 59, @@ -2733,30 +2731,34 @@ sub add_intransit_form { ) { $station = $+{stop}; + # attempt to parse "07:08" short timestamp first $ts = $time_parser->parse_datetime( $+{timestamp} ); - if ( $ts ) { + if ($ts) { + # fill in last stop's (or at the first stop, our departure's) # date to complete the datetime $ts = $ts->set( - year => $prev_ts->year, + year => $prev_ts->year, month => $prev_ts->month, - day => $prev_ts->day + day => $prev_ts->day ); + # if we go back in time with this, assume we went # over midnight and add a day, e.g. in case of a stop # at 23:00 followed by one at 01:30 - if ($ts < $prev_ts) { + if ( $ts < $prev_ts ) { $ts = $ts->add( days => 1 ); } - } else { + } + else { # do a full datetime parse $ts = $parser->parse_datetime( $+{timestamp} ); } if ( $ts and $ts >= $prev_ts ) { $station_data{sched_arr} = $ts->epoch; $station_data{sched_dep} = $ts->epoch; - $prev_ts = $ts; + $prev_ts = $ts; } else { $self->render( |