Unverified Commit 1ed38fb0 authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

EFA: show checkin suggestions

parent 6eb67559
Loading
Loading
Loading
Loading
+23 −0
Original line number Diff line number Diff line
@@ -1368,6 +1368,28 @@ sub station {
					station_name     => $status->stop->full_name,
					related_stations => [],
				};
				my $backend_id
				  = $self->stations->get_backend_id( efa => $efa_service );
				my @destinations = $self->journeys->get_connection_targets(
					uid        => $uid,
					backend_id => $backend_id,
					eva        => $status->{station_eva},
				);
				for my $dep (@results) {
					destination: for my $dest (@destinations) {
						for my $stop ( $dep->route_post ) {
							if ( $stop->full_name eq $dest->{name} ) {
								push( @suggestions, [ $dep, $dest ] );
								next destination;
							}
						}
					}
				}

				@suggestions = map { $_->[0] }
				  sort { $a->[1] <=> $b->[1] }
				  grep { $_->[1] >= $now - 300 and $_->[1] <= $now + 1800 }
				  map  { [ $_, $_->[0]->datetime->epoch ] } @suggestions;
			}
			elsif ($motis_service) {
				@results = map { $_->[0] }
@@ -1504,6 +1526,7 @@ sub station {
					related_stations => $status->{related_stations},
					user_status      => $user_status,
					can_check_out    => $can_check_out,
					suggestions      => \@suggestions,
					title            => "travelynx: $status->{station_name}",
				);
			}
+53 −0
Original line number Diff line number Diff line
<ul class="collection departures connections">
	% for my $res (@{$suggestions}) {
		% my ($dep, $dest) = @{$res};
		% my $row_class = '';
		% my $link_class = 'action-checkin';
		% if ($dep->is_cancelled) {
			% $row_class = 'cancelled';
			% $link_class = 'action-cancelled-from';
		% }
		% if ($checkin_from) {
			<li class="collection-item <%= $row_class %> <%= $link_class %>"
			data-efa="<%= $efa %>"
			data-station="<%= $dep->stop_id_num %>"
			data-train="<%= $dep->id %>"
			data-ts="<%= ($dep->sched_datetime // $dep->datetime)->epoch %>"
			data-dest="<%= $dest->{name} %>">
		% }
		% else {
			<li class="collection-item <%= $row_class %>">
		% }
			<a class="dep-time" href="#">
				% if ($dep->is_cancelled) {
					%= $dep->sched_datetime->strftime('%H:%M')
				% }
				% else {
					%= $dep->datetime->strftime('%H:%M')
				% }
				% if ($dep->delay) {
					%= sprintf('(%+d)', $dep->delay)
				% }
			</a>
			<span class="connect-platform-wrapper">
				% if ($dep->platform) {
					<span>
						% if (($dep->type // q{}) =~ m{ ast | bus | ruf }ix) {
							Steig
						% }
						% else {
							Gleis
						% }
						%= $dep->platform
					</span>
				% }
				<span class="dep-line <%= ($dep->type // q{}) =~ tr{a-zA-Z_-}{}cdr %>">
					%= $dep->line
				</span>
			</span>
			<span class="dep-dest">
				%= $dest->{name}
			</span>
		</li>
	% }
</ul>
+3 −0
Original line number Diff line number Diff line
@@ -103,6 +103,9 @@
				% if ($dbris) {
					%= include '_suggestions_dbris', suggestions => stash('suggestions'), checkin_from => $eva;
				% }
				% elsif ($efa) {
					%= include '_suggestions_efa', suggestions => stash('suggestions'), checkin_from => $eva;
				% }
			% }
		</div>
	</div>