store tz_offset in route data if present

This commit is contained in:
Birte Kristina Friesel 2024-04-03 13:58:48 +02:00
parent 64e0ee5768
commit c9e5bfae62
No known key found for this signature in database
GPG key ID: 19E6E524EBB177BA
2 changed files with 10 additions and 1 deletions

View file

@ -236,6 +236,9 @@ sub get_route_timestamps_p {
dep_delay => $stop->dep_delay, dep_delay => $stop->dep_delay,
load => $stop->load load => $stop->load
}; };
if ( $stop->tz_offset ) {
$ret->{$name}{tz_offset} = $stop->tz_offset;
}
if ( ( $stop->arr_cancelled or not $stop->sched_arr ) if ( ( $stop->arr_cancelled or not $stop->sched_arr )
and ( $stop->dep_cancelled or not $stop->sched_dep ) ) and ( $stop->dep_cancelled or not $stop->sched_dep ) )
{ {

View file

@ -139,6 +139,9 @@ sub add {
} }
] ]
); );
if ( defined $j_stop->tz_offset ) {
$route[-1][2]{tz_offset} = $j_stop->tz_offset;
}
} }
$db->insert( $db->insert(
'in_transit', 'in_transit',
@ -156,7 +159,7 @@ sub add {
train_id => $journey->id, train_id => $journey->id,
sched_departure => $stop->{sched_dep}, sched_departure => $stop->{sched_dep},
real_departure => $stop->{rt_dep} // $stop->{sched_dep}, real_departure => $stop->{rt_dep} // $stop->{sched_dep},
route => $json->encode( [@route] ), route => $json->encode( \@route ),
data => JSON->new->encode( { rt => $stop->{rt_dep} ? 1 : 0 } ), data => JSON->new->encode( { rt => $stop->{rt_dep} ? 1 : 0 } ),
} }
); );
@ -737,6 +740,9 @@ sub update_arrival_hafas {
} }
] ]
); );
if ( defined $j_stop->tz_offset ) {
$route[-1][2]{tz_offset} = $j_stop->tz_offset;
}
} }
my $res_h = $db->select( 'in_transit', ['route'], { user_id => $uid } ) my $res_h = $db->select( 'in_transit', ['route'], { user_id => $uid } )