diff options
author | Birte Kristina Friesel <derf@finalrewind.org> | 2024-08-23 22:44:02 +0200 |
---|---|---|
committer | Birte Kristina Friesel <derf@finalrewind.org> | 2024-08-23 22:44:02 +0200 |
commit | 520e6456001cf858d7e59606a77b1cf0ab115aa9 (patch) | |
tree | b8fa0927e5ee6e06fc77b791817db89c1ffa8669 /lib/Travelynx/Model/Journeys.pm | |
parent | 1a185897e271a9c6471071d8b9b70a5fed16e596 (diff) |
Suggest backends based on coverage and latest checkout coordinates
References #156
Diffstat (limited to 'lib/Travelynx/Model/Journeys.pm')
-rwxr-xr-x | lib/Travelynx/Model/Journeys.pm | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/lib/Travelynx/Model/Journeys.pm b/lib/Travelynx/Model/Journeys.pm index 6d59d44..8a97aef 100755 --- a/lib/Travelynx/Model/Journeys.pm +++ b/lib/Travelynx/Model/Journeys.pm @@ -807,6 +807,32 @@ sub get_oldest_ts { return undef; } +sub get_latest_checkout_latlon { + my ( $self, %opt ) = @_; + my $uid = $opt{uid}; + my $db = $opt{db} // $self->{pg}->db; + + my $res_h = $db->select( + 'journeys_str', + [ 'arr_lat', 'arr_lon', ], + { + user_id => $uid, + cancelled => 0 + }, + { + limit => 1, + order_by => { -desc => 'journey_id' } + } + )->hash; + + if ( not $res_h ) { + return; + } + + return $res_h->{arr_lat}, $res_h->{arr_lon}; + +} + sub get_latest_checkout_ids { my ( $self, %opt ) = @_; my $uid = $opt{uid}; |