Loading lib/Travelynx.pm +23 −15 Original line number Diff line number Diff line Loading @@ -1890,6 +1890,7 @@ sub startup { uid => $uid, db => $db, with_data => 1, with_polyline => 1, with_timestamps => 1, with_visibility => 1, postprocess => 1, Loading Loading @@ -2320,12 +2321,12 @@ sub startup { my @stations = uniq_by { $_->{name} } map { { name => $_->{to_name}, latlon => $_->{to_latlon} name => $_->{to_name} // $_->{arr_name}, latlon => $_->{to_latlon} // $_->{arr_latlon}, }, { name => $_->{from_name}, latlon => $_->{from_latlon} name => $_->{from_name} // $_->{dep_name}, latlon => $_->{from_latlon} // $_->{dep_latlon} } } @journeys; Loading @@ -2350,8 +2351,8 @@ sub startup { for my $journey (@polyline_journeys) { my @polyline = @{ $journey->{polyline} }; my $from_eva = $journey->{from_eva}; my $to_eva = $journey->{to_eva}; my $from_eva = $journey->{from_eva} // $journey->{dep_eva}; my $to_eva = $journey->{to_eva} // $journey->{arr_eva}; my $from_index = first_index { $_->[2] and $_->[2] == $from_eva } @polyline; Loading Loading @@ -2387,7 +2388,7 @@ sub startup { or $to_index == -1 ) { # Fall back to route delete $journey->{polyline}; push( @beeline_journeys, $journey ); next; } Loading Loading @@ -2422,13 +2423,19 @@ sub startup { my @route = @{ $journey->{route} }; my $from_index = first_index { ( $_->[1] and $_->[1] == $journey->{from_eva} ) or $_->[0] eq $journey->{from_name} ( $_->[1] and $_->[1] == ( $journey->{from_eva} // $journey->{dep_eva} ) ) or $_->[0] eq ( $journey->{from_name} // $journey->{dep_name} ) } @route; my $to_index = first_index { ( $_->[1] and $_->[1] == $journey->{to_eva} ) or $_->[0] eq $journey->{to_name} ( $_->[1] and $_->[1] == ( $journey->{to_eva} // $journey->{arr_eva} ) ) or $_->[0] eq ( $journey->{to_name} // $journey->{arr_name} ) } @route; Loading @@ -2436,7 +2443,7 @@ sub startup { my $rename = $self->app->renamed_station; $from_index = first_index { ( $rename->{ $_->[0] } // $_->[0] ) eq $journey->{from_name} ( $journey->{from_name} // $journey->{dep_name} ) } @route; } Loading @@ -2444,7 +2451,7 @@ sub startup { my $rename = $self->app->renamed_station; $to_index = first_index { ( $rename->{ $_->[0] } // $_->[0] ) eq $journey->{to_name} ( $journey->{to_name} // $journey->{arr_name} ) } @route; } Loading @@ -2467,7 +2474,8 @@ sub startup { # and entered manually (-> beeline also shown on map, typically # significantly differs from detailed route) -- unless the user # sets include_manual, of course. if ( $journey->{edited} & 0x0010 if ( $journey->{edited} and $journey->{edited} & 0x0010 and @route <= 2 and not $include_manual ) { Loading lib/Travelynx/Controller/Profile.pm +27 −1 Original line number Diff line number Diff line Loading @@ -111,6 +111,13 @@ sub profile { $status->{arr_name} = undef; } my $map_data = {}; if ( $status->{checked_in} ) { $map_data = $self->journeys_to_map_data( journeys => [$status], ); } my @journeys; if ( Loading Loading @@ -190,6 +197,8 @@ sub profile { : 0, journey => $status, journeys => [@journeys], with_map => 1, %{$map_data}, } ); } Loading Loading @@ -494,6 +503,13 @@ sub user_status { $og_data{description} = $tw_data{description} = q{}; } my $map_data = {}; if ( $status->{checked_in} ) { $map_data = $self->journeys_to_map_data( journeys => [$status], ); } $self->respond_to( json => { json => { Loading @@ -516,6 +532,8 @@ sub user_status { journey => $status, twitter => \%tw_data, opengraph => \%og_data, with_map => 1, %{$map_data}, version => $self->app->config->{version} // 'UNKNOWN', }, ); Loading Loading @@ -555,6 +573,7 @@ sub status_card { my $status = $self->get_user_status( $user->{id} ); my $visibility; my $map_data = {}; if ( $status->{checked_in} or $status->{arr_name} ) { my $visibility = $status->{effective_visibility}; if ( Loading @@ -579,12 +598,19 @@ sub status_card { $status->{arr_name} = undef; } if ( $status->{checked_in} ) { $map_data = $self->journeys_to_map_data( journeys => [$status], ); } $self->render( '_public_status_card', name => $name, privacy => $user, journey => $status, from_profile => $self->param('profile') ? 1 : 0, %{$map_data}, ); } Loading lib/Travelynx/Controller/Traveling.pm +15 −0 Original line number Diff line number Diff line Loading @@ -353,6 +353,9 @@ sub homepage { $self->stash( timeline => [@timeline] ); my @recent_targets; if ( $status->{checked_in} ) { my $map_data = $self->journeys_to_map_data( journeys => [$status], ); my $journey_visibility = $self->compute_effective_visibility( $user->{default_visibility_str}, Loading @@ -371,6 +374,8 @@ sub homepage { journey_visibility => $journey_visibility, connections_iris => $connections_iris, connections_hafas => $connections_hafas, with_map => 1, %{$map_data}, ); $self->users->mark_seen( uid => $uid ); } Loading @@ -381,6 +386,8 @@ sub homepage { user => $user, user_status => $status, journey_visibility => $journey_visibility, with_map => 1, %{$map_data}, ); $self->users->mark_seen( uid => $uid ); } Loading @@ -393,6 +400,8 @@ sub homepage { user => $user, user_status => $status, journey_visibility => $journey_visibility, with_map => 1, %{$map_data}, ); $self->users->mark_seen( uid => $uid ); return; Loading Loading @@ -431,6 +440,9 @@ sub status_card { $self->stash( timeline => [@timeline] ); if ( $status->{checked_in} ) { my $map_data = $self->journeys_to_map_data( journeys => [$status], ); my $journey_visibility = $self->compute_effective_visibility( $self->current_user->{default_visibility_str}, Loading @@ -448,6 +460,7 @@ sub status_card { journey_visibility => $journey_visibility, connections_iris => $connections_iris, connections_hafas => $connections_hafas, %{$map_data}, ); } )->catch( Loading @@ -456,6 +469,7 @@ sub status_card { '_checked_in', journey => $status, journey_visibility => $journey_visibility, %{$map_data}, ); } )->wait; Loading @@ -465,6 +479,7 @@ sub status_card { '_checked_in', journey => $status, journey_visibility => $journey_visibility, %{$map_data}, ); } elsif ( $status->{cancellation} ) { Loading lib/Travelynx/Model/InTransit.pm +17 −15 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ my %visibility_itoa = ( 60 => 'followers', 30 => 'unlisted', 10 => 'private', default => 'default', ); my %visibility_atoi = ( Loading Loading @@ -360,16 +361,14 @@ sub postprocess { $ret->{wagongroups} = $ret->{user_data}{wagongroups}; $ret->{platform_type} = 'Gleis'; if ( $ret->{train_type} =~ m{ ast | bus | ruf }ix ) { if ( $ret->{train_type} and $ret->{train_type} =~ m{ ast | bus | ruf }ix ) { $ret->{platform_type} = 'Steig'; } $ret->{visibility_str} = $ret->{visibility} ? $visibility_itoa{ $ret->{visibility} } : 'default'; = $visibility_itoa{ $ret->{visibility} // 'default' }; $ret->{effective_visibility_str} = $visibility_itoa{ $ret->{effective_visibility} }; = $visibility_itoa{ $ret->{effective_visibility} // 'default' }; my @parsed_messages; for my $message ( @{ $ret->{messages} // [] } ) { Loading Loading @@ -461,7 +460,7 @@ sub get { my $table = 'in_transit'; if ( $opt{with_timestamps} ) { if ( $opt{with_timestamps} or $opt{with_polyline} ) { $table = 'in_transit_str'; } Loading @@ -475,13 +474,16 @@ sub get { $ret = $res->hash; } if ( $opt{with_polyline} and $ret ) { $ret->{dep_latlon} = [ $ret->{dep_lat}, $ret->{dep_lon} ]; $ret->{arr_latlon} = [ $ret->{arr_lat}, $ret->{arr_lon} ]; } if ( $opt{with_visibility} and $ret ) { $ret->{visibility_str} = $ret->{visibility} ? $visibility_itoa{ $ret->{visibility} } : 'default'; = $visibility_itoa{ $ret->{visibility} // 'default' }; $ret->{effective_visibility_str} = $visibility_itoa{ $ret->{effective_visibility} }; = $visibility_itoa{ $ret->{effective_visibility} // 'default' }; } if ( $opt{postprocess} and $ret ) { Loading templates/_checked_in.html.ep +10 −2 Original line number Diff line number Diff line Loading @@ -324,6 +324,7 @@ % if ($journey->{arr_name}) { <div class="card" style="margin-top: <%= scalar @{stash('timeline') // []} ? '1.5rem' : '3em' %>;"> <div class="card-content"> <i class="material-icons small right sync-failed-marker grey-text" style="display: none;">sync_problem</i> <span class="card-title">Meldungen</span> % if (@{$journey->{extra_data}{him_msg} // []}) { <p style="margin-bottom: 2ex;"> Loading Loading @@ -371,8 +372,15 @@ % } </div> </div> % } % if ($journey->{arr_name}) { <div class="card" style="margin-top: 3em;"> <div class="card-content"> <i class="material-icons small right sync-failed-marker grey-text" style="display: none;">sync_problem</i> <span class="card-title">Karte</span> <div id="map" style="height: 70vh;"> </div> %= include '_map', with_map_header => 0, station_coordinates => stash('station_coordinates'), polyline_groups => stash('polyline_groups') </div> </div> <div class="card" style="margin-top: 3em;"> <div class="card-content"> <i class="material-icons small right sync-failed-marker grey-text" style="display: none;">sync_problem</i> Loading Loading
lib/Travelynx.pm +23 −15 Original line number Diff line number Diff line Loading @@ -1890,6 +1890,7 @@ sub startup { uid => $uid, db => $db, with_data => 1, with_polyline => 1, with_timestamps => 1, with_visibility => 1, postprocess => 1, Loading Loading @@ -2320,12 +2321,12 @@ sub startup { my @stations = uniq_by { $_->{name} } map { { name => $_->{to_name}, latlon => $_->{to_latlon} name => $_->{to_name} // $_->{arr_name}, latlon => $_->{to_latlon} // $_->{arr_latlon}, }, { name => $_->{from_name}, latlon => $_->{from_latlon} name => $_->{from_name} // $_->{dep_name}, latlon => $_->{from_latlon} // $_->{dep_latlon} } } @journeys; Loading @@ -2350,8 +2351,8 @@ sub startup { for my $journey (@polyline_journeys) { my @polyline = @{ $journey->{polyline} }; my $from_eva = $journey->{from_eva}; my $to_eva = $journey->{to_eva}; my $from_eva = $journey->{from_eva} // $journey->{dep_eva}; my $to_eva = $journey->{to_eva} // $journey->{arr_eva}; my $from_index = first_index { $_->[2] and $_->[2] == $from_eva } @polyline; Loading Loading @@ -2387,7 +2388,7 @@ sub startup { or $to_index == -1 ) { # Fall back to route delete $journey->{polyline}; push( @beeline_journeys, $journey ); next; } Loading Loading @@ -2422,13 +2423,19 @@ sub startup { my @route = @{ $journey->{route} }; my $from_index = first_index { ( $_->[1] and $_->[1] == $journey->{from_eva} ) or $_->[0] eq $journey->{from_name} ( $_->[1] and $_->[1] == ( $journey->{from_eva} // $journey->{dep_eva} ) ) or $_->[0] eq ( $journey->{from_name} // $journey->{dep_name} ) } @route; my $to_index = first_index { ( $_->[1] and $_->[1] == $journey->{to_eva} ) or $_->[0] eq $journey->{to_name} ( $_->[1] and $_->[1] == ( $journey->{to_eva} // $journey->{arr_eva} ) ) or $_->[0] eq ( $journey->{to_name} // $journey->{arr_name} ) } @route; Loading @@ -2436,7 +2443,7 @@ sub startup { my $rename = $self->app->renamed_station; $from_index = first_index { ( $rename->{ $_->[0] } // $_->[0] ) eq $journey->{from_name} ( $journey->{from_name} // $journey->{dep_name} ) } @route; } Loading @@ -2444,7 +2451,7 @@ sub startup { my $rename = $self->app->renamed_station; $to_index = first_index { ( $rename->{ $_->[0] } // $_->[0] ) eq $journey->{to_name} ( $journey->{to_name} // $journey->{arr_name} ) } @route; } Loading @@ -2467,7 +2474,8 @@ sub startup { # and entered manually (-> beeline also shown on map, typically # significantly differs from detailed route) -- unless the user # sets include_manual, of course. if ( $journey->{edited} & 0x0010 if ( $journey->{edited} and $journey->{edited} & 0x0010 and @route <= 2 and not $include_manual ) { Loading
lib/Travelynx/Controller/Profile.pm +27 −1 Original line number Diff line number Diff line Loading @@ -111,6 +111,13 @@ sub profile { $status->{arr_name} = undef; } my $map_data = {}; if ( $status->{checked_in} ) { $map_data = $self->journeys_to_map_data( journeys => [$status], ); } my @journeys; if ( Loading Loading @@ -190,6 +197,8 @@ sub profile { : 0, journey => $status, journeys => [@journeys], with_map => 1, %{$map_data}, } ); } Loading Loading @@ -494,6 +503,13 @@ sub user_status { $og_data{description} = $tw_data{description} = q{}; } my $map_data = {}; if ( $status->{checked_in} ) { $map_data = $self->journeys_to_map_data( journeys => [$status], ); } $self->respond_to( json => { json => { Loading @@ -516,6 +532,8 @@ sub user_status { journey => $status, twitter => \%tw_data, opengraph => \%og_data, with_map => 1, %{$map_data}, version => $self->app->config->{version} // 'UNKNOWN', }, ); Loading Loading @@ -555,6 +573,7 @@ sub status_card { my $status = $self->get_user_status( $user->{id} ); my $visibility; my $map_data = {}; if ( $status->{checked_in} or $status->{arr_name} ) { my $visibility = $status->{effective_visibility}; if ( Loading @@ -579,12 +598,19 @@ sub status_card { $status->{arr_name} = undef; } if ( $status->{checked_in} ) { $map_data = $self->journeys_to_map_data( journeys => [$status], ); } $self->render( '_public_status_card', name => $name, privacy => $user, journey => $status, from_profile => $self->param('profile') ? 1 : 0, %{$map_data}, ); } Loading
lib/Travelynx/Controller/Traveling.pm +15 −0 Original line number Diff line number Diff line Loading @@ -353,6 +353,9 @@ sub homepage { $self->stash( timeline => [@timeline] ); my @recent_targets; if ( $status->{checked_in} ) { my $map_data = $self->journeys_to_map_data( journeys => [$status], ); my $journey_visibility = $self->compute_effective_visibility( $user->{default_visibility_str}, Loading @@ -371,6 +374,8 @@ sub homepage { journey_visibility => $journey_visibility, connections_iris => $connections_iris, connections_hafas => $connections_hafas, with_map => 1, %{$map_data}, ); $self->users->mark_seen( uid => $uid ); } Loading @@ -381,6 +386,8 @@ sub homepage { user => $user, user_status => $status, journey_visibility => $journey_visibility, with_map => 1, %{$map_data}, ); $self->users->mark_seen( uid => $uid ); } Loading @@ -393,6 +400,8 @@ sub homepage { user => $user, user_status => $status, journey_visibility => $journey_visibility, with_map => 1, %{$map_data}, ); $self->users->mark_seen( uid => $uid ); return; Loading Loading @@ -431,6 +440,9 @@ sub status_card { $self->stash( timeline => [@timeline] ); if ( $status->{checked_in} ) { my $map_data = $self->journeys_to_map_data( journeys => [$status], ); my $journey_visibility = $self->compute_effective_visibility( $self->current_user->{default_visibility_str}, Loading @@ -448,6 +460,7 @@ sub status_card { journey_visibility => $journey_visibility, connections_iris => $connections_iris, connections_hafas => $connections_hafas, %{$map_data}, ); } )->catch( Loading @@ -456,6 +469,7 @@ sub status_card { '_checked_in', journey => $status, journey_visibility => $journey_visibility, %{$map_data}, ); } )->wait; Loading @@ -465,6 +479,7 @@ sub status_card { '_checked_in', journey => $status, journey_visibility => $journey_visibility, %{$map_data}, ); } elsif ( $status->{cancellation} ) { Loading
lib/Travelynx/Model/InTransit.pm +17 −15 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ my %visibility_itoa = ( 60 => 'followers', 30 => 'unlisted', 10 => 'private', default => 'default', ); my %visibility_atoi = ( Loading Loading @@ -360,16 +361,14 @@ sub postprocess { $ret->{wagongroups} = $ret->{user_data}{wagongroups}; $ret->{platform_type} = 'Gleis'; if ( $ret->{train_type} =~ m{ ast | bus | ruf }ix ) { if ( $ret->{train_type} and $ret->{train_type} =~ m{ ast | bus | ruf }ix ) { $ret->{platform_type} = 'Steig'; } $ret->{visibility_str} = $ret->{visibility} ? $visibility_itoa{ $ret->{visibility} } : 'default'; = $visibility_itoa{ $ret->{visibility} // 'default' }; $ret->{effective_visibility_str} = $visibility_itoa{ $ret->{effective_visibility} }; = $visibility_itoa{ $ret->{effective_visibility} // 'default' }; my @parsed_messages; for my $message ( @{ $ret->{messages} // [] } ) { Loading Loading @@ -461,7 +460,7 @@ sub get { my $table = 'in_transit'; if ( $opt{with_timestamps} ) { if ( $opt{with_timestamps} or $opt{with_polyline} ) { $table = 'in_transit_str'; } Loading @@ -475,13 +474,16 @@ sub get { $ret = $res->hash; } if ( $opt{with_polyline} and $ret ) { $ret->{dep_latlon} = [ $ret->{dep_lat}, $ret->{dep_lon} ]; $ret->{arr_latlon} = [ $ret->{arr_lat}, $ret->{arr_lon} ]; } if ( $opt{with_visibility} and $ret ) { $ret->{visibility_str} = $ret->{visibility} ? $visibility_itoa{ $ret->{visibility} } : 'default'; = $visibility_itoa{ $ret->{visibility} // 'default' }; $ret->{effective_visibility_str} = $visibility_itoa{ $ret->{effective_visibility} }; = $visibility_itoa{ $ret->{effective_visibility} // 'default' }; } if ( $opt{postprocess} and $ret ) { Loading
templates/_checked_in.html.ep +10 −2 Original line number Diff line number Diff line Loading @@ -324,6 +324,7 @@ % if ($journey->{arr_name}) { <div class="card" style="margin-top: <%= scalar @{stash('timeline') // []} ? '1.5rem' : '3em' %>;"> <div class="card-content"> <i class="material-icons small right sync-failed-marker grey-text" style="display: none;">sync_problem</i> <span class="card-title">Meldungen</span> % if (@{$journey->{extra_data}{him_msg} // []}) { <p style="margin-bottom: 2ex;"> Loading Loading @@ -371,8 +372,15 @@ % } </div> </div> % } % if ($journey->{arr_name}) { <div class="card" style="margin-top: 3em;"> <div class="card-content"> <i class="material-icons small right sync-failed-marker grey-text" style="display: none;">sync_problem</i> <span class="card-title">Karte</span> <div id="map" style="height: 70vh;"> </div> %= include '_map', with_map_header => 0, station_coordinates => stash('station_coordinates'), polyline_groups => stash('polyline_groups') </div> </div> <div class="card" style="margin-top: 3em;"> <div class="card-content"> <i class="material-icons small right sync-failed-marker grey-text" style="display: none;">sync_problem</i> Loading