manual journey entry: hardcode DB (HAFAS) for station selection

TODO: Add a dropdown to select different backends

Closes #150
This commit is contained in:
Birte Kristina Friesel 2024-08-04 08:49:57 +02:00
parent aec37cce68
commit 0c5908e722
No known key found for this signature in database
GPG key ID: 19E6E524EBB177BA
2 changed files with 7 additions and 4 deletions

View file

@ -2116,6 +2116,7 @@ sub add_journey_form {
$opt{db} = $db; $opt{db} = $db;
$opt{uid} = $self->current_user->{id}; $opt{uid} = $self->current_user->{id};
$opt{backend_id} = 1;
my ( $journey_id, $error ) = $self->journeys->add(%opt); my ( $journey_id, $error ) = $self->journeys->add(%opt);

View file

@ -118,8 +118,10 @@ sub add {
my $db = $opt{db}; my $db = $opt{db};
my $uid = $opt{uid}; my $uid = $opt{uid};
my $now = DateTime->now( time_zone => 'Europe/Berlin' ); my $now = DateTime->now( time_zone => 'Europe/Berlin' );
my $dep_station = $self->{stations}->search( $opt{dep_station} ); my $dep_station = $self->{stations}
my $arr_station = $self->{stations}->search( $opt{arr_station} ); ->search( $opt{dep_station}, backend_id => $opt{backend_id} );
my $arr_station = $self->{stations}
->search( $opt{arr_station}, backend_id => $opt{backend_id} );
if ( not $dep_station ) { if ( not $dep_station ) {
return ( undef, 'Unbekannter Startbahnhof' ); return ( undef, 'Unbekannter Startbahnhof' );