Skip to content
GitLab
Explore
Sign in
derf
Travel-Routing-DE-HAFAS
Compare revisions
5c9127df3d10d3a3bd420341c20498ac545ca23e to cdff0a8efeba471abe297b431160af27e3573905
Commits on Source (2)
hafas: show departure date in connection header
· 55795b6d
Birte Kristina Friesel
authored
Dec 30, 2023
55795b6d
bin/hafas: handle partial cancellations
· cdff0a8e
Birte Kristina Friesel
authored
Jan 08, 2024
cdff0a8e
Hide whitespace changes
Inline
Side-by-side
bin/hafas
View file @
cdff0a8e
...
...
@@ -217,7 +217,7 @@ sub show_similar_stops {
sub
display_occupancy
{
my
(
$occupancy
)
=
@_
;
if
(
not
defined
$occupancy
)
{
if
(
not
defined
$occupancy
)
{
return
q{?}
;
}
if
(
$occupancy
==
1
)
{
...
...
@@ -297,12 +297,16 @@ for my $res ( $hafas->connections ) {
}
my
$negative_transfer
;
my
$part_cancelled
;
my
$glance
=
q{}
;
for
my
$sec
(
$res
->
sections
)
{
if
(
$sec
->
type
ne
'
JNY
'
)
{
next
;
}
if
(
$sec
->
dep_cancelled
or
$sec
->
arr_cancelled
)
{
$part_cancelled
=
1
;
}
if
(
defined
$sec
->
transfer_duration
)
{
if
(
$sec
->
transfer_duration
->
in_units
('
minutes
')
>=
0
)
{
$glance
.=
sprintf
(
...
...
@@ -321,18 +325,20 @@ for my $res ( $hafas->connections ) {
}
}
if
(
$cancelled
or
$negative_transfer
)
{
if
(
$cancelled
or
$negative_transfer
or
$part_cancelled
)
{
printf
(
"
--:-- (%02d:%02d) %s %s %s
\n
",
"
%s (%02d:%02d) %s %s %s
\n
",
$res
->
dep
->
strftime
('
XX.XX. %H:%M
'),
$res
->
duration
->
in_units
(
'
hours
',
'
minutes
'
),
$res
->
arr
->
strftime
('
%H:%M
'),
display_occupancies
(
$res
->
load
),
$glance
display_occupancies
(
$res
->
load
),
$glance
);
}
else
{
printf
(
"
%s (%02d:%02d) %s %s %s
\n
",
$res
->
dep
->
strftime
('
%H:%M
'),
$res
->
dep
->
strftime
('
%d.%m.
%H:%M
'),
$res
->
duration
->
in_units
(
'
hours
',
'
minutes
'
),
$res
->
arr
->
strftime
('
%H:%M
'),
display_occupancies
(
$res
->
load
),
...
...