add_route_timestamps: keep real-time data where possible

This commit is contained in:
Derf Null 2023-04-30 07:42:48 +02:00
parent 6bdbe82949
commit 796699a9c6
No known key found for this signature in database
GPG key ID: 19E6E524EBB177BA

View file

@ -1016,7 +1016,16 @@ sub startup {
if ( $station->[2]{isCancelled} ) {
$sd->{isCancelled} = 1;
}
# keep rt_dep / rt_arr if they are no longer present
my %old;
for my $k (qw(rt_arr rt_dep arr_delay dep_delay)) {
$old{$k} = $station->[2]{$k};
}
$station->[2] = $sd;
for my $k (qw(rt_arr rt_dep arr_delay dep_delay)) {
$station->[2]{$k} ||= $old{$k};
}
}
}