summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornetworkException <git@nwex.de>2025-05-15 17:35:43 +0200
committerGitHub <noreply@github.com>2025-05-15 17:35:43 +0200
commitae9d9eb60018e0b69bf072ce21cfab48fc1ef6ae (patch)
tree09c759e4dafe5bf1f1dda37509bf42d16cb1e326
parent0da47417faefbd1bdb6cb57b163d619e1329f59a (diff)
Generate bahn.expert details link based on trip_id for DBRIS (#36)4.37.2
Generate bahn.expert details link based on trip_id for DBRIS This patch adds a conditional for the train details page to generate the bahn.expert details outlink based on the trip_id when using DBRIS bahn.de. This is a lot more reliable compared to concating category and train number / date. As bahn.expert recently added support for resolving these HAFAS trip ids to RIS::Journey journeys, the data quality is also on par. See https://chaos.social/@marudor/114404980599765615 --------- Co-authored-by: Birte Kristina Friesel <birte.friesel@uos.de>
-rw-r--r--templates/_train_details.html.ep4
1 files changed, 3 insertions, 1 deletions
diff --git a/templates/_train_details.html.ep b/templates/_train_details.html.ep
index a1c46db..6f9de56 100644
--- a/templates/_train_details.html.ep
+++ b/templates/_train_details.html.ep
@@ -155,7 +155,9 @@
<a class="smallbutton" href="/carriage-formation?<%= $departure->{wr_link} %>&amp;e=<%= $departure->{wr_direction} // '' %>"><i class="material-icons" aria-hidden="true">train</i> <%= $departure->{wr_text} || 'Wagen' %>
</a>
% }
-% if ($departure->{train_type} and $departure->{train_no} and (not param('hafas') or param('hafas') eq 'DB')) {
+% if ($departure->{trip_id} and param('dbris') eq 'bahn.de') {
+ <a class="smallbutton" href="https://bahn.expert/details/x/h/<%= Mojo::Util::url_escape( $departure->{trip_id} ) %>"><img src="/static/icons/bahn-expert.svg">Details</a>
+% } elsif ($departure->{train_type} and $departure->{train_no} and (not param('hafas') or param('hafas') eq 'DB')) {
<a class="smallbutton" href="https://bahn.expert/details/<%= $departure->{train_type} %>%20<%= $departure->{train_no} %>/<%= ($departure->{date} // DateTime->now(time_zone => 'Europe/Berlin'))->iso8601 %>?evaNumberAlongRoute=<%= $departure->{eva} %>"><img src="/static/icons/bahn-expert.svg">Details</a>
% }
% for my $link (@{$departure->{links}}) {