Loading lib/Travelynx/Controller/Traveling.pm +28 −1 Original line number Diff line number Diff line Loading @@ -797,11 +797,38 @@ sub map_history { } my $route_type = $self->param('route_type'); my $filter_from = $self->param('filter_after'); my $filter_until = $self->param('filter_before'); my $with_polyline = $route_type eq 'beeline' ? 0 : 1; my $parser = DateTime::Format::Strptime->new( pattern => '%d.%m.%Y', locale => 'de_DE', time_zone => 'Europe/Berlin' ); if ( $filter_from and $filter_from =~ m{ ^ (\d+) [.] (\d+) [.] (\d+) $ }x ) { $filter_from = $parser->parse_datetime($filter_from); } else { $filter_from = undef; } if ( $filter_until and $filter_until =~ m{ ^ (\d+) [.] (\d+) [.] (\d+) $ }x ) { $filter_until = $parser->parse_datetime($filter_until); } else { $filter_until = undef; } my @journeys = $self->journeys->get( uid => $self->current_user->{id}, with_polyline => $with_polyline with_polyline => $with_polyline, after => $filter_from, before => $filter_until, ); if ( not @journeys ) { Loading lib/Travelynx/Model/Journeys.pm +19 −12 Original line number Diff line number Diff line Loading @@ -519,6 +519,12 @@ sub get { $where{real_dep_ts} = { -between => [ $opt{after}->epoch, $opt{before}->epoch, ] }; } elsif ( $opt{after} ) { $where{real_dep_ts} = { '>=', $opt{after}->epoch }; } elsif ( $opt{before} ) { $where{real_dep_ts} = { '<=', $opt{before}->epoch }; } if ( $opt{with_polyline} ) { push( @select, 'polyline' ); Loading Loading @@ -975,9 +981,10 @@ sub get_travel_distance { for my $station (@polyline) { #lonlatlonlat $distance_polyline += $geo->distance_metal( $prev_station->[1], $prev_station->[0], $station->[1], $station->[0] ); $distance_polyline += $geo->distance_metal( $prev_station->[1], $prev_station->[0], $station->[1], $station->[0] ); $prev_station = $station; } Loading @@ -1004,9 +1011,10 @@ sub get_travel_distance { $to_station_beeline = $station; } if ( $#{$prev_station} >= 4 and $#{$station} >= 4 ) { $distance_intermediate += $geo->distance_metal( $prev_station->[4], $prev_station->[3], $station->[4], $station->[3] ); $distance_intermediate += $geo->distance_metal( $prev_station->[4], $prev_station->[3], $station->[4], $station->[3] ); } else { $skipped++; Loading @@ -1017,9 +1025,8 @@ sub get_travel_distance { if ( $from_station_beeline and $to_station_beeline ) { $distance_beeline = $geo->distance_metal( $from_station_beeline->[4], $from_station_beeline->[3], $to_station_beeline->[4], $to_station_beeline->[3] $from_station_beeline->[4], $from_station_beeline->[3], $to_station_beeline->[4], $to_station_beeline->[3] ); } Loading templates/history_map.html.ep +23 −1 Original line number Diff line number Diff line Loading @@ -13,7 +13,7 @@ %= form_for '/history/map' => begin <p> Detailgrad und Filter: Detailgrad: </p> <div class="row"> <div class="input-field col s12"> Loading Loading @@ -54,6 +54,28 @@ </button> </div> </div> <p> Weitere Filter: </p> <div class="row"> <div class="input-field col s12"> %= text_field 'filter_after', id => 'filter_after', class => 'validate', pattern => '[0-9][0-9]?[.][0-9][0-9]?[.][0-9][0-9][0-9][0-9]( +[0-9][0-9]:[0-9][0-9])?' <label for="filter_after">Abfahrt ab (DD.MM.YYYY)</label> </div> </div> <div class="row"> <div class="input-field col s12"> %= text_field 'filter_before', id => 'filter_before', class => 'validate', pattern => '[0-9][0-9]?[.][0-9][0-9]?[.][0-9][0-9][0-9][0-9]( +[0-9][0-9]:[0-9][0-9])?' <label for="filter_before">Abfahrt bis (DD.MM.YYYY)</label> </div> </div> <div class="row"> <div class="col s12 center-align"> <button class="btn wave-effect waves-light" type="submit"> Anzeigen </button> </div> </div> %= end <div class="row"> Loading Loading
lib/Travelynx/Controller/Traveling.pm +28 −1 Original line number Diff line number Diff line Loading @@ -797,11 +797,38 @@ sub map_history { } my $route_type = $self->param('route_type'); my $filter_from = $self->param('filter_after'); my $filter_until = $self->param('filter_before'); my $with_polyline = $route_type eq 'beeline' ? 0 : 1; my $parser = DateTime::Format::Strptime->new( pattern => '%d.%m.%Y', locale => 'de_DE', time_zone => 'Europe/Berlin' ); if ( $filter_from and $filter_from =~ m{ ^ (\d+) [.] (\d+) [.] (\d+) $ }x ) { $filter_from = $parser->parse_datetime($filter_from); } else { $filter_from = undef; } if ( $filter_until and $filter_until =~ m{ ^ (\d+) [.] (\d+) [.] (\d+) $ }x ) { $filter_until = $parser->parse_datetime($filter_until); } else { $filter_until = undef; } my @journeys = $self->journeys->get( uid => $self->current_user->{id}, with_polyline => $with_polyline with_polyline => $with_polyline, after => $filter_from, before => $filter_until, ); if ( not @journeys ) { Loading
lib/Travelynx/Model/Journeys.pm +19 −12 Original line number Diff line number Diff line Loading @@ -519,6 +519,12 @@ sub get { $where{real_dep_ts} = { -between => [ $opt{after}->epoch, $opt{before}->epoch, ] }; } elsif ( $opt{after} ) { $where{real_dep_ts} = { '>=', $opt{after}->epoch }; } elsif ( $opt{before} ) { $where{real_dep_ts} = { '<=', $opt{before}->epoch }; } if ( $opt{with_polyline} ) { push( @select, 'polyline' ); Loading Loading @@ -975,9 +981,10 @@ sub get_travel_distance { for my $station (@polyline) { #lonlatlonlat $distance_polyline += $geo->distance_metal( $prev_station->[1], $prev_station->[0], $station->[1], $station->[0] ); $distance_polyline += $geo->distance_metal( $prev_station->[1], $prev_station->[0], $station->[1], $station->[0] ); $prev_station = $station; } Loading @@ -1004,9 +1011,10 @@ sub get_travel_distance { $to_station_beeline = $station; } if ( $#{$prev_station} >= 4 and $#{$station} >= 4 ) { $distance_intermediate += $geo->distance_metal( $prev_station->[4], $prev_station->[3], $station->[4], $station->[3] ); $distance_intermediate += $geo->distance_metal( $prev_station->[4], $prev_station->[3], $station->[4], $station->[3] ); } else { $skipped++; Loading @@ -1017,9 +1025,8 @@ sub get_travel_distance { if ( $from_station_beeline and $to_station_beeline ) { $distance_beeline = $geo->distance_metal( $from_station_beeline->[4], $from_station_beeline->[3], $to_station_beeline->[4], $to_station_beeline->[3] $from_station_beeline->[4], $from_station_beeline->[3], $to_station_beeline->[4], $to_station_beeline->[3] ); } Loading
templates/history_map.html.ep +23 −1 Original line number Diff line number Diff line Loading @@ -13,7 +13,7 @@ %= form_for '/history/map' => begin <p> Detailgrad und Filter: Detailgrad: </p> <div class="row"> <div class="input-field col s12"> Loading Loading @@ -54,6 +54,28 @@ </button> </div> </div> <p> Weitere Filter: </p> <div class="row"> <div class="input-field col s12"> %= text_field 'filter_after', id => 'filter_after', class => 'validate', pattern => '[0-9][0-9]?[.][0-9][0-9]?[.][0-9][0-9][0-9][0-9]( +[0-9][0-9]:[0-9][0-9])?' <label for="filter_after">Abfahrt ab (DD.MM.YYYY)</label> </div> </div> <div class="row"> <div class="input-field col s12"> %= text_field 'filter_before', id => 'filter_before', class => 'validate', pattern => '[0-9][0-9]?[.][0-9][0-9]?[.][0-9][0-9][0-9][0-9]( +[0-9][0-9]:[0-9][0-9])?' <label for="filter_before">Abfahrt bis (DD.MM.YYYY)</label> </div> </div> <div class="row"> <div class="col s12 center-align"> <button class="btn wave-effect waves-light" type="submit"> Anzeigen </button> </div> </div> %= end <div class="row"> Loading