summaryrefslogtreecommitdiff
path: root/lib/Travelynx/Model
diff options
context:
space:
mode:
authorBirte Kristina Friesel <derf@finalrewind.org>2023-09-24 18:19:17 +0200
committerBirte Kristina Friesel <derf@finalrewind.org>2023-09-24 18:19:17 +0200
commitde074342de0bdc3604a0610a0c5f9cce5338bb85 (patch)
tree721c6c7415945ca57779e51db5dde00e136a62c2 /lib/Travelynx/Model
parent8810acf742629294713448408ab6f0719f17952f (diff)
add support for HAFAS connection suggestions; drop manual destination list
Still TODO: handle stations that have several EVAs
Diffstat (limited to 'lib/Travelynx/Model')
-rwxr-xr-xlib/Travelynx/Model/Journeys.pm3
-rw-r--r--lib/Travelynx/Model/Users.pm27
2 files changed, 3 insertions, 27 deletions
diff --git a/lib/Travelynx/Model/Journeys.pm b/lib/Travelynx/Model/Journeys.pm
index 1c975f4..3fa2d96 100755
--- a/lib/Travelynx/Model/Journeys.pm
+++ b/lib/Travelynx/Model/Journeys.pm
@@ -1726,7 +1726,7 @@ sub get_connection_targets {
my $min_count = $opt{min_count} // 3;
if ( $opt{destination_name} ) {
- return ( $opt{destination_name} );
+ return ( { eva => $opt{eva}, name => $opt{destination_name} } );
}
my $dest_id = $opt{eva} // $self->get_latest_dest_id(%opt);
@@ -1755,7 +1755,6 @@ sub get_connection_targets {
= $res->hashes->grep( sub { shift->{count} >= $min_count } )
->map( sub { shift->{dest} } )->each;
@destinations = $self->{stations}->get_by_evas(@destinations);
- @destinations = map { $_->{name} } @destinations;
return @destinations;
}
diff --git a/lib/Travelynx/Model/Users.pm b/lib/Travelynx/Model/Users.pm
index 4b108d4..4602fa2 100644
--- a/lib/Travelynx/Model/Users.pm
+++ b/lib/Travelynx/Model/Users.pm
@@ -567,7 +567,6 @@ sub delete {
$res{transit} = $db->delete( 'in_transit', { user_id => $uid } );
$res{hooks} = $db->delete( 'webhooks', { user_id => $uid } );
$res{trwl} = $db->delete( 'traewelling', { user_id => $uid } );
- $res{lt} = $db->delete( 'localtransit', { user_id => $uid } );
$res{password} = $db->delete( 'pending_passwords', { user_id => $uid } );
$res{relations} = $db->delete( 'relations',
[ { subject_id => $uid }, { object_id => $uid } ] );
@@ -651,34 +650,12 @@ sub use_history {
my $uid = $opt{uid};
my $value = $opt{set};
- if ( $opt{destinations} ) {
- $db->insert(
- 'localtransit',
- {
- user_id => $uid,
- data =>
- JSON->new->encode( { destinations => $opt{destinations} } )
- },
- { on_conflict => \'(user_id) do update set data = EXCLUDED.data' }
- );
- }
-
if ($value) {
$db->update( 'users', { use_history => $value }, { id => $uid } );
}
else {
- if ( $opt{with_local_transit} ) {
- my $res = $db->select(
- 'user_transit',
- [ 'use_history', 'data' ],
- { id => $uid }
- )->expand->hash;
- return ( $res->{use_history}, $res->{data}{destinations} // [] );
- }
- else {
- return $db->select( 'users', ['use_history'], { id => $uid } )
- ->hash->{use_history};
- }
+ return $db->select( 'users', ['use_history'], { id => $uid } )
+ ->hash->{use_history};
}
}