summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBirte Kristina Friesel <derf@finalrewind.org>2024-04-03 13:58:48 +0200
committerBirte Kristina Friesel <derf@finalrewind.org>2024-04-03 13:58:48 +0200
commitc9e5bfae620c3df002c286b1463a2838395797fd (patch)
treea675aa63349fb2d41258c60a2410c4087806e772 /lib
parent64e0ee57683389587f5ff9dc282318a85014ccd5 (diff)
store tz_offset in route data if present
Diffstat (limited to 'lib')
-rw-r--r--lib/Travelynx/Helper/HAFAS.pm3
-rw-r--r--lib/Travelynx/Model/InTransit.pm8
2 files changed, 10 insertions, 1 deletions
diff --git a/lib/Travelynx/Helper/HAFAS.pm b/lib/Travelynx/Helper/HAFAS.pm
index 38bed56..2bab8dc 100644
--- a/lib/Travelynx/Helper/HAFAS.pm
+++ b/lib/Travelynx/Helper/HAFAS.pm
@@ -236,6 +236,9 @@ sub get_route_timestamps_p {
dep_delay => $stop->dep_delay,
load => $stop->load
};
+ if ( $stop->tz_offset ) {
+ $ret->{$name}{tz_offset} = $stop->tz_offset;
+ }
if ( ( $stop->arr_cancelled or not $stop->sched_arr )
and ( $stop->dep_cancelled or not $stop->sched_dep ) )
{
diff --git a/lib/Travelynx/Model/InTransit.pm b/lib/Travelynx/Model/InTransit.pm
index fa9c464..6d3d0e1 100644
--- a/lib/Travelynx/Model/InTransit.pm
+++ b/lib/Travelynx/Model/InTransit.pm
@@ -139,6 +139,9 @@ sub add {
}
]
);
+ if ( defined $j_stop->tz_offset ) {
+ $route[-1][2]{tz_offset} = $j_stop->tz_offset;
+ }
}
$db->insert(
'in_transit',
@@ -156,7 +159,7 @@ sub add {
train_id => $journey->id,
sched_departure => $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 } ),
}
);
@@ -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 } )