From cc76d03925b18cacc91c8f0f86cc39b6f42bf3b8 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sat, 29 Oct 2022 15:37:57 +0200 Subject: train_details: handle stops without arr/dep data --- templates/_train_details.html.ep | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'templates') diff --git a/templates/_train_details.html.ep b/templates/_train_details.html.ep index e5d5c72..d3815fe 100644 --- a/templates/_train_details.html.ep +++ b/templates/_train_details.html.ep @@ -214,11 +214,11 @@ % else { generic-stop % } -% if ($stop->{rt_dep} and $stop->{dep_delay}) { - "><%= $stop->{sched_dep}->strftime('%H:%M') %> (heute <%= $stop->{rt_dep}->strftime('%H:%M') %>) <%= $stop->{name} %> +% if (($stop->{rt_dep} and $stop->{dep_delay}) or (not $stop->{rt_dep} and $stop->{rt_arr} and $stop->{arr_delay})) { + "><%= ($stop->{sched_dep} // $stop->{sched_arr})->strftime('%H:%M') %> (heute <%= ($stop->{rt_dep} // $stop->{rt_arr})->strftime('%H:%M') %>) <%= $stop->{name} %> % } % else { - "><%= $stop->{sched_dep} ? $stop->{sched_dep}->strftime('%H:%M') : q{} %> + "><%= ($stop->{sched_dep} // $stop->{sched_arr}) ? ($stop->{sched_dep} // $stop->{sched_arr})->strftime('%H:%M') : q{} %> % if ($stop->{rt_bogus}) { gps_off % } @@ -259,11 +259,11 @@ % else { generic-stop % } -% if ($stop->{rt_arr} and $stop->{arr_delay}) { - "><%= $stop->{sched_arr}->strftime('%H:%M') %> (heute <%= $stop->{rt_arr}->strftime('%H:%M') %>) <%= $stop->{name} %> +% if (($stop->{rt_arr} and $stop->{arr_delay}) or (not $stop->{rt_arr} and $stop->{rt_dep} and $stop->{dep_delay})) { + "><%= ($stop->{sched_arr} // $stop->{sched_dep})->strftime('%H:%M') %> (heute <%= ($stop->{rt_arr} // $stop->{rt_dep})->strftime('%H:%M') %>) <%= $stop->{name} %> % } % else { - "><%= $stop->{sched_arr} ? $stop->{sched_arr}->strftime('%H:%M') : q{} %> + "><%= ($stop->{sched_arr} // $stop->{sched_dep}) ? ($stop->{sched_arr} // $stop->{sched_dep})->strftime('%H:%M') : q{} %> % if ($stop->{rt_bogus}) { gps_off % } -- cgit v1.2.3