Skip to content

Commit

Permalink
passenger rights: show departures with delay ≥ 20 minutes as well
Browse files Browse the repository at this point in the history
This is a quick workaround until I have finally reviewed #116
  • Loading branch information
derf committed Sep 20, 2024
1 parent fbc21f4 commit 515754b
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 6 deletions.
7 changes: 5 additions & 2 deletions lib/Travelynx/Controller/Passengerrights.pm
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ sub list_candidates {
}
}
my @abo_journeys
= grep { $_->{delay} >= 20 and $_->{delay} < 60 } @journeys;
@journeys = grep { $_->{delay} >= 60 or $_->{connection_missed} } @journeys;
my @cancelled = $self->journeys->get(
Expand Down Expand Up @@ -154,8 +156,9 @@ sub list_candidates {
$self->respond_to(
json => { json => [@journeys] },
any => {
template => 'passengerrights',
journeys => [@journeys]
template => 'passengerrights',
journeys => [@journeys],
abo_journeys => [@abo_journeys]
}
);
}
Expand Down
69 changes: 65 additions & 4 deletions templates/passengerrights.html.ep
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
<div class="row">
<div class="col s12">
<p>
Gemäß der Fahrgastrechte im Eisenbahnverkehr besteht ab 60 Minuten
Verspätung am Ziel ein Entschädigungsanspruch gegenüber dem
Eisenbahnverkehrsunternehmen. Dieser kann mit dem
Fahrgastrechteformular geltend gemacht werden.
Ab 60 Minuten Verspätung am Ziel besteht in einigen Fällen ein
Entschädigungsanspruch gegenüber dem Eisenbahnverkehrsunternehmen.
Dieser kann mit dem Fahrgastrechteformular oder online geltend
gemacht werden.
</p>
<p>
Die folgenden Zugfahrten sind wahrscheinliche Kandidaten dafür.
Expand Down Expand Up @@ -73,3 +73,64 @@
</table>
</div>
</div>

<div class="row">
<div class="col s12">
<p>
Bei Abo-Tickets besteht teilweise die Möglichkeit, bereits ab 20
Minuten Verspätung Fahrten gesammelt zu Entschädigungszwecken
einzureichen. Die folgenden Zugfahrten sind Kandidaten dafür.
Fahrten mit einer Verspätung von 60 Minuten oder mehr werden hier
nicht aufgeführt.
</p>
</div>
</div>

<div class="row">
<div class="col s12">
<table class="striped">
<thead>
<tr>
<th>Datum</th>
<th>Zug</th>
<th>Verspätung</th>
</tr>
</thead>
<tbody>
% for my $journey (@{$abo_journeys}) {
% my $detail_link = '/journey/' . $journey->{id};
<tr>
<td><%= $journey->{sched_departure}->strftime('%d.%m.%Y') %></td>
<td><a href="<%= $detail_link %>">
<%= $journey->{type} %> <%= $journey->{line} // $journey->{no} %>
→ <%= $journey->{to_name} %>
% if ($journey->{connection}) {
% $detail_link = '/journey/' . $journey->{connection}{id};
</a><br/><a href="<%= $detail_link %>">
<%= $journey->{connection}{type} %> <%= $journey->{connection}{line} // $journey->{connection}{no} %>
→ <%= $journey->{connection}{to_name} %>
% }
</a></td>
<td>
% if ($journey->{cancelled}) {
% if ($journey->{has_substitute}) {
Ausfall, Ersatzverbindung
%= sprintf('%+d', $journey->{substitute_delay})
% }
% else {
Ausfall ohne Ersatzverbindung
% }
% }
% elsif ($journey->{connection}) {
%= sprintf('%+d, ggf. Anschluss verpasst', $journey->{delay})
% }
% else {
%= sprintf('%+d', $journey->{delay})
% }
</td>
</tr>
% }
</tbody>
</table>
</div>
</div>

0 comments on commit 515754b

Please sign in to comment.