diff options
| author | Birte Kristina Friesel <derf@finalrewind.org> | 2025-09-18 20:52:32 +0200 | 
|---|---|---|
| committer | Birte Kristina Friesel <derf@finalrewind.org> | 2025-09-18 20:52:32 +0200 | 
| commit | 3233b996b3c31976e8aee42dc867e7ad92dd61dc (patch) | |
| tree | 2842fff596770f185b3cfaf5b5fa529fc753a1ae /lib/Travelynx/Model/Stations.pm | |
| parent | 0a2fdea55f38c30904600c1ae0322256ade0e53d (diff) | |
Stations->get_by_names: backend_id is mandatory these days
Diffstat (limited to 'lib/Travelynx/Model/Stations.pm')
| -rw-r--r-- | lib/Travelynx/Model/Stations.pm | 19 | 
1 files changed, 12 insertions, 7 deletions
| diff --git a/lib/Travelynx/Model/Stations.pm b/lib/Travelynx/Model/Stations.pm index c6d9730..5316118 100644 --- a/lib/Travelynx/Model/Stations.pm +++ b/lib/Travelynx/Model/Stations.pm @@ -461,11 +461,16 @@ sub get_by_name {  # Slow  sub get_by_names { -	my ( $self, @names ) = @_; +	my ( $self, %opt ) = @_; -	my @ret -	  = $self->{pg}->db->select( 'stations', '*', { name => { '=', \@names } } ) -	  ->hashes->each; +	my @ret = $self->{pg}->db->select( +		'stations', +		'*', +		{ +			name   => { '=', $opt{names} }, +			source => $opt{backend_id} +		} +	)->hashes->each;  	return @ret;  } @@ -506,10 +511,10 @@ sub search {  # Slow  sub grep_unknown { -	my ( $self, @stations ) = @_; +	my ( $self, %opt ) = @_; -	my %station = map { $_->{name} => 1 } $self->get_by_names(@stations); -	my @unknown_stations = grep { not $station{$_} } @stations; +	my %station          = map  { $_->{name} => 1 } $self->get_by_names(%opt); +	my @unknown_stations = grep { not $station{$_} } @{ $opt{names} };  	return @unknown_stations;  } | 
