summaryrefslogtreecommitdiff
path: root/lib/Travelynx/Model/Stations.pm
diff options
context:
space:
mode:
authorBirte Kristina Friesel <derf@finalrewind.org>2023-12-27 10:59:35 +0100
committerBirte Kristina Friesel <derf@finalrewind.org>2023-12-27 10:59:35 +0100
commitd47195a0cf30a64ca7afcbbeed6edb6b54039104 (patch)
tree3a993c3c303958fd5b5e08058c01cb995ff91477 /lib/Travelynx/Model/Stations.pm
parentc24edf3027ab4513e99e3aba876fc19199c35b12 (diff)
Switch to Travel::Status::DE::HAFAS 5.x
Diffstat (limited to 'lib/Travelynx/Model/Stations.pm')
-rw-r--r--lib/Travelynx/Model/Stations.pm19
1 files changed, 10 insertions, 9 deletions
diff --git a/lib/Travelynx/Model/Stations.pm b/lib/Travelynx/Model/Stations.pm
index 147219f..5bbe781 100644
--- a/lib/Travelynx/Model/Stations.pm
+++ b/lib/Travelynx/Model/Stations.pm
@@ -17,33 +17,34 @@ sub new {
sub add_or_update {
my ( $self, %opt ) = @_;
my $stop = $opt{stop};
+ my $loc = $stop->loc;
my $source = 1;
my $db = $opt{db} // $self->{pg}->db;
- if ( my $s = $self->get_by_eva( $stop->eva, db => $db ) ) {
+ if ( my $s = $self->get_by_eva( $loc->eva, db => $db ) ) {
if ( $source == 1 and $s->{source} == 0 and not $s->{archived} ) {
return;
}
$db->update(
'stations',
{
- name => $stop->name,
- lat => $stop->lat,
- lon => $stop->lon,
+ name => $loc->name,
+ lat => $loc->lat,
+ lon => $loc->lon,
source => $source,
archived => 0
},
- { eva => $stop->eva }
+ { eva => $loc->eva }
);
return;
}
$db->insert(
'stations',
{
- eva => $stop->eva,
- name => $stop->name,
- lat => $stop->lat,
- lon => $stop->lon,
+ eva => $loc->eva,
+ name => $loc->name,
+ lat => $loc->lat,
+ lon => $loc->lon,
source => $source,
archived => 0
}